Transaction#hash.

This commit is contained in:
Stefan Thomas
2013-11-07 13:55:38 -08:00
parent 3491fec469
commit e65f975e29
3 changed files with 93 additions and 7 deletions

View File

@@ -216,13 +216,16 @@ SerializedObject.prototype.serialize = function (typedef, obj) {
}
};
SerializedObject.prototype.signing_hash = function (prefix) {
SerializedObject.prototype.hash = function (prefix) {
var sign_buffer = new SerializedObject();
stypes.Int32.serialize(sign_buffer, prefix);
sign_buffer.append(this.buffer);
return sign_buffer.hash_sha512_half();
};
// DEPRECATED
SerializedObject.prototype.signing_hash = SerializedObject.prototype.hash;
SerializedObject.prototype.hash_sha512_half = function () {
var bits = sjcl.codec.bytes.toBits(this.buffer);
var hash = sjcl.bitArray.bitSlice(sjcl.hash.sha512.hash(bits), 0, 256);