mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
22 lines
443 B
JavaScript
22 lines
443 B
JavaScript
(function() {
|
|
'use strict';
|
|
|
|
var crypto = require('crypto');
|
|
|
|
module.exports = function(algo, password) {
|
|
var result, sha;
|
|
|
|
if (!password) {
|
|
password = algo;
|
|
algo = 'sha512WithRSAEncryption';
|
|
}
|
|
|
|
sha = crypto.createHash(algo);
|
|
|
|
sha.update(password);
|
|
result = sha.digest('hex');
|
|
|
|
return result;
|
|
};
|
|
|
|
})();
|