sodium-javascript/crypto_shorthash.js

15 lines
530 B
JavaScript
Raw Permalink Normal View History

2017-06-12 09:01:21 +00:00
var siphash = require('siphash24')
2017-06-12 08:05:49 +00:00
if (new Uint16Array([1])[0] !== 1) throw new Error('Big endian architecture is not supported.')
2017-06-12 08:05:49 +00:00
exports.crypto_shorthash_PRIMITIVE = 'siphash24'
2017-06-12 09:01:21 +00:00
exports.crypto_shorthash_BYTES = siphash.BYTES
exports.crypto_shorthash_KEYBYTES = siphash.KEYBYTES
exports.crypto_shorthash_WASM_SUPPORTED = siphash.WASM_SUPPORTED
2017-11-17 11:07:52 +00:00
exports.crypto_shorthash_WASM_LOADED = siphash.WASM_LOADED
2017-06-12 08:05:49 +00:00
exports.crypto_shorthash = shorthash
function shorthash (out, data, key, noAssert) {
2017-06-12 09:01:21 +00:00
siphash(data, key, out, noAssert)
2017-06-12 08:05:49 +00:00
}