{"size": 569, "ext": "js", "max_stars_repo_path": "node_modules/uppercase-core/SRC/COMMON/UTIL/ENCRYPTION/ENCRYPT.js", "max_stars_repo_name": "Hanul/UPPERCASE-MODEL", "max_stars_repo_stars_event_min_datetime": "2016-03-23T05:26:32.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-26T10:51:20.000Z", "max_issues_repo_path": "node_modules/uppercase-core/SRC/COMMON/UTIL/ENCRYPTION/ENCRYPT.js", "max_issues_repo_name": "Hanul/UPPERCASE-MODEL", "max_issues_repo_issues_event_min_datetime": "2015-11-26T12:36:33.000Z", "max_issues_repo_issues_event_max_datetime": "2020-09-22T14:59:43.000Z", "max_forks_repo_path": "node_modules/uppercase-core/SRC/COMMON/UTIL/ENCRYPTION/ENCRYPT.js", "max_forks_repo_name": "Hanul/UPPERCASE-MODEL", "max_forks_repo_forks_event_min_datetime": "2016-05-16T12:06:39.000Z", "max_forks_repo_forks_event_max_datetime": "2020-06-21T06:23:17.000Z"}
{"max_stars_count": 21, "max_issues_count": 8, "max_forks_count": 6, "avg_line_length": 19.6206896552, "max_line_length": 84, "alphanum_fraction": 0.6080843585}
/*
 * 비밀번호를 주어진 키를 암호화합니다. 같은 키로 한번 더 수행하면, 복호화됩니다.
 */
global.ENCRYPT = METHOD({

	run : (params) => {
		//REQUIRED: params
		//REQUIRED: params.password
		//REQUIRED: params.key

		let password = String(params.password);
		let key = String(params.key);
		
		let result = '';
		
		let keyLength = key.length;
		let keyCount = 0;
		for (let i = 0; i < password.length; i += 1) {
			result += String.fromCharCode(password.charCodeAt(i) ^ key.charCodeAt(keyCount));
			keyCount += 1;
			if (keyCount === keyLength) {
				keyCount = 0;
			}
		}
		
		return result;
	}
});
