base58 will left trim NULL bytes, handling JSVerify RNG state 0dec6b2a5f04d19873
This commit is contained in:
parent
86b4e0e7a4
commit
8fd3e680e4
@ -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('') + '/?' +
|
||||||
|
Loading…
Reference in New Issue
Block a user