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

View file

@ -175,6 +175,14 @@ describe('Model', function () {
jsc.array(common.jscQueryString()),
'nestring',
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),
clean = jsdom('', {
url: schema.join('') + '://' + address.join('') +
@ -194,6 +202,14 @@ describe('Model', function () {
'nestring',
jsc.array(common.jscHashString()),
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),
clean = jsdom('', {
url: schema.join('') + '://' + address.join('') + '/?' +