{"size": 973, "ext": "js", "max_stars_repo_path": "scrypt.wrapper.js", "max_stars_repo_name": "AntonLydike/scrypt-webworker", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "scrypt.wrapper.js", "max_issues_repo_name": "AntonLydike/scrypt-webworker", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "scrypt.wrapper.js", "max_forks_repo_name": "AntonLydike/scrypt-webworker", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.9487179487, "max_line_length": 88, "alphanum_fraction": 0.6269270298}
// global Scrypt object
let Scrypt;
function initScrypt(params, connection) {

	try {
		scrypt_module_factory(function (scrypt) {
		  try {
				function checkScryptParameter (param) {
					if (typeof param == "string") {						
						return scrypt.encode_utf8(param);
					}
					
					return param;
				}
				
				scrypt.hash = function (passw, salt) {
					passw = checkScryptParameter(passw);
					salt  = checkScryptParameter(salt);
					
					return scrypt.crypto_scrypt(passw, salt, params.n, params.r, params.p, params.l);
				}
				
				if (params.doTest) {
					scrypt.hash("test run", "with salt");
				}

				Scrypt = scrypt;

				connection.return(true);
		  } catch (e) {
				// initial test failed, use more ram!
				connection.error("SCRYPT:BAD_TEST_RUN","Scrypt had an error while the test run", e);
			}	
		}, {requested_total_memory: params.n * 2048}); 
	} catch (e) {
		connection.error("SCRYPT:BAD_DEPLOY","Scrypt had an error while deploying", e);
	}

}