triplesec
Version:
A CommonJS-compliant system for secure encryption of smallish secrets
56 lines (40 loc) • 1.49 kB
JavaScript
// Generated by IcedCoffeeScript 108.0.8
(function() {
var SHA224, SHA256, WordArray, transform,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
WordArray = require('./wordarray').WordArray;
SHA256 = require('./sha256').SHA256;
SHA224 = (function(_super) {
__extends(SHA224, _super);
function SHA224() {
return SHA224.__super__.constructor.apply(this, arguments);
}
SHA224.output_size = 224 / 8;
SHA224.prototype.output_size = SHA224.output_size;
SHA224.prototype._doReset = function() {
return this._hash = new WordArray([0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4]);
};
SHA224.prototype._doFinalize = function() {
var hash;
hash = SHA224.__super__._doFinalize.call(this);
hash.sigBytes -= 4;
return hash;
};
SHA224.prototype.clone = function() {
var out;
out = new SHA224();
this.copy_to(out);
return out;
};
return SHA224;
})(SHA256);
transform = function(x) {
var out;
out = (new SHA224).finalize(x);
x.scrub();
return out;
};
exports.SHA224 = SHA224;
exports.transform = transform;
}).call(this);