Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1ca83f1bd | ||
|
|
c81ef709d1 | ||
|
|
4e1c69ba13 | ||
|
|
5159d68fa9 | ||
|
|
5ccdcdee17 | ||
|
|
48081c6896 | ||
|
|
b1741bfdae | ||
|
|
f7de366eec | ||
|
|
51e11143e5 |
+2
-2
@@ -6,7 +6,7 @@ module.exports.crypto_kdf_PRIMITIVE = 'blake2b'
|
|||||||
module.exports.crypto_kdf_BYTES_MIN = 16
|
module.exports.crypto_kdf_BYTES_MIN = 16
|
||||||
module.exports.crypto_kdf_BYTES_MAX = 64
|
module.exports.crypto_kdf_BYTES_MAX = 64
|
||||||
module.exports.crypto_kdf_CONTEXTBYTES = 8
|
module.exports.crypto_kdf_CONTEXTBYTES = 8
|
||||||
module.exports.crypto_kdf_KEYBYTES = 64
|
module.exports.crypto_kdf_KEYBYTES = 32
|
||||||
|
|
||||||
function STORE64_LE(dest, int) {
|
function STORE64_LE(dest, int) {
|
||||||
var mul = 1
|
var mul = 1
|
||||||
@@ -29,7 +29,7 @@ module.exports.crypto_kdf_derive_from_key = function crypto_kdf_derive_from_key
|
|||||||
STORE64_LE(salt, subkey_id)
|
STORE64_LE(salt, subkey_id)
|
||||||
|
|
||||||
var outlen = Math.min(subkey.length, module.exports.crypto_kdf_BYTES_MAX)
|
var outlen = Math.min(subkey.length, module.exports.crypto_kdf_BYTES_MAX)
|
||||||
blake2b(outlen, key, salt, ctx_padded, true)
|
blake2b(outlen, key.subarray(0, module.exports.crypto_kdf_KEYBYTES), salt, ctx_padded, true)
|
||||||
.final(subkey)
|
.final(subkey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,13 +5,8 @@ exports.crypto_shorthash_BYTES = siphash.BYTES
|
|||||||
exports.crypto_shorthash_KEYBYTES = siphash.KEYBYTES
|
exports.crypto_shorthash_KEYBYTES = siphash.KEYBYTES
|
||||||
exports.crypto_shorthash_WASM_SUPPORTED = siphash.WASM_SUPPORTED
|
exports.crypto_shorthash_WASM_SUPPORTED = siphash.WASM_SUPPORTED
|
||||||
exports.crypto_shorthash_WASM_LOADED = siphash.WASM_LOADED
|
exports.crypto_shorthash_WASM_LOADED = siphash.WASM_LOADED
|
||||||
exports.crypto_shorthash_ready = siphash.ready
|
|
||||||
exports.crypto_shorthash = shorthash
|
exports.crypto_shorthash = shorthash
|
||||||
|
|
||||||
siphash.ready(function () {
|
|
||||||
exports.crypto_shorthash_WASM_LOADED = siphash.WASM_LOADED
|
|
||||||
})
|
|
||||||
|
|
||||||
function shorthash (out, data, key, noAssert) {
|
function shorthash (out, data, key, noAssert) {
|
||||||
siphash(data, key, out, noAssert)
|
siphash(data, key, out, noAssert)
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sodium-javascript",
|
"name": "sodium-javascript",
|
||||||
"version": "0.5.2",
|
"version": "0.5.5",
|
||||||
"description": "WIP - a pure javascript version of sodium-native",
|
"description": "WIP - a pure javascript version of sodium-native",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -14,6 +14,12 @@
|
|||||||
"browserify": "^14.1.0",
|
"browserify": "^14.1.0",
|
||||||
"sodium-test": "^0.7.0"
|
"sodium-test": "^0.7.0"
|
||||||
},
|
},
|
||||||
|
"browser": {
|
||||||
|
"crypto": false
|
||||||
|
},
|
||||||
|
"react-native": {
|
||||||
|
"crypto": "crypto"
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"browser": "browserify test.js | browser-run",
|
"browser": "browserify test.js | browser-run",
|
||||||
"browser-manual": "browserify test.js | browser-run -p 1234",
|
"browser-manual": "browserify test.js | browser-run -p 1234",
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@ var randombytes = (function () {
|
|||||||
return browserBytes
|
return browserBytes
|
||||||
} else if (typeof require !== 'undefined') {
|
} else if (typeof require !== 'undefined') {
|
||||||
// Node.js.
|
// Node.js.
|
||||||
crypto = require('cry' + 'pto');
|
crypto = require('crypto')
|
||||||
if (crypto && crypto.randomBytes) {
|
if (crypto && crypto.randomBytes) {
|
||||||
return nodeBytes
|
return nodeBytes
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user