HOUSEKEEPING: vdk_aecrypt package installs
Blake was being stupid so I copied the contents of this package directly into the source of JR, but really this should be its own package. So now doing that refactoring.
This commit is contained in:
@@ -11,12 +11,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
import * as blakejs from './jex_include/local-blakejs-1.2.1/dist/index.js';
|
// @ts-ignore FIXME yes blake2b sucks
|
||||||
|
import * as blake2b from './jex_include/local-blakejs-1.2.1/dist/blake2b.js';
|
||||||
import * as vdk_binary from './jex_include/local-vdk_binary-0.1.0/dist/vdk_binary.js';
|
import * as vdk_binary from './jex_include/local-vdk_binary-0.1.0/dist/vdk_binary.js';
|
||||||
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
hash_and_salt_msg,
|
hash_and_salt_msg,
|
||||||
|
hash,
|
||||||
salt_msg,
|
salt_msg,
|
||||||
btc_varuint_encode
|
btc_varuint_encode
|
||||||
}
|
}
|
||||||
@@ -103,12 +105,27 @@ hash_and_salt_msg
|
|||||||
: Uint8Array
|
: Uint8Array
|
||||||
{
|
{
|
||||||
let message_bytes : Uint8Array = vdk_binary.encode_utf8(message_str);
|
let message_bytes : Uint8Array = vdk_binary.encode_utf8(message_str);
|
||||||
return blakejs.blake2b(salt_msg(message_bytes), // bytes to hash
|
let salted_bytes : Uint8Array = salt_msg(message_bytes);
|
||||||
undefined, // key (optional)
|
return hash(salted_bytes);
|
||||||
32); // resulting byte length
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blake2 hash of data
|
||||||
|
*/
|
||||||
|
function
|
||||||
|
hash
|
||||||
|
(data_bytes : Uint8Array)
|
||||||
|
: Uint8Array
|
||||||
|
{
|
||||||
|
return blake2b.blake2b(data_bytes, // bytes to hash
|
||||||
|
undefined, // key (optional)
|
||||||
|
32); // resulting byte length
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* salt the message
|
* salt the message
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user