base58 will left trim NULL bytes, handling JSVerify RNG state 0dec6b2a5f04d19873

This commit is contained in:
El RIDO 2019-05-19 09:05:56 +02:00
parent 86b4e0e7a4
commit 8fd3e680e4
No known key found for this signature in database
GPG Key ID: 0F5C940A6BD81F92
1 changed files with 16 additions and 0 deletions

View File

@ -175,6 +175,14 @@ describe('Model', function () {
jsc.array(common.jscQueryString()), jsc.array(common.jscQueryString()),
'nestring', 'nestring',
function (schema, address, query, fragment) { function (schema, address, query, fragment) {
// base58 strips leading NULL bytes
while(fragment.charAt(0) === '\u0000') {
fragment = fragment.substr(1);
}
// string may not be empty (when only NULL bytes and trimmed)
if (fragment.length === 0) {
return true;
}
let fragmentString = $.PrivateBin.CryptTool.base58encode(fragment), let fragmentString = $.PrivateBin.CryptTool.base58encode(fragment),
clean = jsdom('', { clean = jsdom('', {
url: schema.join('') + '://' + address.join('') + url: schema.join('') + '://' + address.join('') +
@ -194,6 +202,14 @@ describe('Model', function () {
'nestring', 'nestring',
jsc.array(common.jscHashString()), jsc.array(common.jscHashString()),
function (schema, address, query, fragment, trail) { function (schema, address, query, fragment, trail) {
// base58 strips leading NULL bytes
while(fragment.charAt(0) === '\u0000') {
fragment = fragment.substr(1);
}
// string may not be empty (when only NULL bytes and trimmed)
if (fragment.length === 0) {
return true;
}
let fragmentString = $.PrivateBin.CryptTool.base58encode(fragment), let fragmentString = $.PrivateBin.CryptTool.base58encode(fragment),
clean = jsdom('', { clean = jsdom('', {
url: schema.join('') + '://' + address.join('') + '/?' + url: schema.join('') + '://' + address.join('') + '/?' +