From daea58c91efafebabcfc5c26a14dc8b47631b9b6 Mon Sep 17 00:00:00 2001 From: Peter Date: Sun, 28 May 2023 13:25:51 -0600 Subject: [PATCH] vdk_tests_cases appears done --- libs/vdk_tests_cases/.gitignore | 4 + libs/vdk_tests_cases/dist/cases.d.ts | 2 +- .../jex_include/local-vdk-0.1.0/dist/b58.d.ts | 12 - .../jex_include/local-vdk-0.1.0/dist/b58.js | 308 -------- .../local-vdk-0.1.0/dist/b58.js.map | 1 - .../jex_include/local-vdk-0.1.0/dist/b64.d.ts | 12 - .../jex_include/local-vdk-0.1.0/dist/b64.js | 507 -------------- .../local-vdk-0.1.0/dist/b64.js.map | 1 - .../jex_include/local-vdk-0.1.0/dist/bin.d.ts | 28 - .../jex_include/local-vdk-0.1.0/dist/bin.js | 266 ------- .../local-vdk-0.1.0/dist/bin.js.map | 1 - .../local-vdk-0.1.0/dist/faert.d.ts | 30 - .../jex_include/local-vdk-0.1.0/dist/faert.js | 344 --------- .../local-vdk-0.1.0/dist/faert.js.map | 1 - .../jex_include/local-vdk-0.1.0/dist/rlp.d.ts | 37 - .../jex_include/local-vdk-0.1.0/dist/rlp.js | 382 ---------- .../local-vdk-0.1.0/dist/rlp.js.map | 1 - .../local-vdk-0.1.0/dist/safe.d.ts | 66 -- .../jex_include/local-vdk-0.1.0/dist/safe.js | 58 -- .../local-vdk-0.1.0/dist/safe.js.map | 1 - .../jex_include/local-vdk-0.1.0/src/b58.ts | 418 ----------- .../jex_include/local-vdk-0.1.0/src/b64.ts | 655 ------------------ .../jex_include/local-vdk-0.1.0/src/bin.ts | 377 ---------- .../jex_include/local-vdk-0.1.0/src/faert.ts | 399 ----------- .../jex_include/local-vdk-0.1.0/src/rlp.ts | 521 -------------- .../jex_include/local-vdk-0.1.0/src/safe.ts | 112 --- libs/vdk_tests_cases/dist/rlpcases.d.ts | 2 +- libs/vdk_tests_cases/jex.eterms | 4 +- .../jex_mindist/dist/cases.d.ts | 2 +- .../jex_include/local-vdk-0.1.0/dist/b58.d.ts | 12 - .../jex_include/local-vdk-0.1.0/dist/b58.js | 308 -------- .../local-vdk-0.1.0/dist/b58.js.map | 1 - .../jex_include/local-vdk-0.1.0/dist/b64.d.ts | 12 - .../jex_include/local-vdk-0.1.0/dist/b64.js | 507 -------------- .../local-vdk-0.1.0/dist/b64.js.map | 1 - .../jex_include/local-vdk-0.1.0/dist/bin.d.ts | 28 - .../jex_include/local-vdk-0.1.0/dist/bin.js | 266 ------- .../local-vdk-0.1.0/dist/bin.js.map | 1 - .../local-vdk-0.1.0/dist/faert.d.ts | 30 - .../jex_include/local-vdk-0.1.0/dist/faert.js | 344 --------- .../local-vdk-0.1.0/dist/faert.js.map | 1 - .../jex_include/local-vdk-0.1.0/dist/rlp.d.ts | 37 - .../jex_include/local-vdk-0.1.0/dist/rlp.js | 382 ---------- .../local-vdk-0.1.0/dist/rlp.js.map | 1 - .../local-vdk-0.1.0/dist/safe.d.ts | 66 -- .../jex_include/local-vdk-0.1.0/dist/safe.js | 58 -- .../local-vdk-0.1.0/dist/safe.js.map | 1 - .../jex_include/local-vdk-0.1.0/src/b58.ts | 418 ----------- .../jex_include/local-vdk-0.1.0/src/b64.ts | 655 ------------------ .../jex_include/local-vdk-0.1.0/src/bin.ts | 377 ---------- .../jex_include/local-vdk-0.1.0/src/faert.ts | 399 ----------- .../jex_include/local-vdk-0.1.0/src/rlp.ts | 521 -------------- .../jex_include/local-vdk-0.1.0/src/safe.ts | 112 --- .../jex_mindist/dist/rlpcases.d.ts | 2 +- .../jex_mindist/src/rlpcases.ts | 2 +- .../jex_include/local-vdk-0.1.0/dist/b58.d.ts | 12 - .../jex_include/local-vdk-0.1.0/dist/b58.js | 308 -------- .../local-vdk-0.1.0/dist/b58.js.map | 1 - .../jex_include/local-vdk-0.1.0/dist/b64.d.ts | 12 - .../jex_include/local-vdk-0.1.0/dist/b64.js | 507 -------------- .../local-vdk-0.1.0/dist/b64.js.map | 1 - .../jex_include/local-vdk-0.1.0/dist/bin.d.ts | 28 - .../jex_include/local-vdk-0.1.0/dist/bin.js | 266 ------- .../local-vdk-0.1.0/dist/bin.js.map | 1 - .../local-vdk-0.1.0/dist/faert.d.ts | 30 - .../jex_include/local-vdk-0.1.0/dist/faert.js | 344 --------- .../local-vdk-0.1.0/dist/faert.js.map | 1 - .../jex_include/local-vdk-0.1.0/dist/rlp.d.ts | 37 - .../jex_include/local-vdk-0.1.0/dist/rlp.js | 382 ---------- .../local-vdk-0.1.0/dist/rlp.js.map | 1 - .../local-vdk-0.1.0/dist/safe.d.ts | 66 -- .../jex_include/local-vdk-0.1.0/dist/safe.js | 58 -- .../local-vdk-0.1.0/dist/safe.js.map | 1 - .../jex_include/local-vdk-0.1.0/src/b58.ts | 418 ----------- .../jex_include/local-vdk-0.1.0/src/b64.ts | 655 ------------------ .../jex_include/local-vdk-0.1.0/src/bin.ts | 377 ---------- .../jex_include/local-vdk-0.1.0/src/faert.ts | 399 ----------- .../jex_include/local-vdk-0.1.0/src/rlp.ts | 521 -------------- .../jex_include/local-vdk-0.1.0/src/safe.ts | 112 --- libs/vdk_tests_cases/src/rlpcases.ts | 2 +- 80 files changed, 12 insertions(+), 13622 deletions(-) create mode 100644 libs/vdk_tests_cases/.gitignore delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b58.d.ts delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b58.js delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b58.js.map delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b64.d.ts delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b64.js delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b64.js.map delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/bin.d.ts delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/bin.js delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/bin.js.map delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/faert.d.ts delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/faert.js delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/faert.js.map delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/rlp.d.ts delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/rlp.js delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/rlp.js.map delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/safe.d.ts delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/safe.js delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/safe.js.map delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/b58.ts delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/b64.ts delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/bin.ts delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/faert.ts delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/rlp.ts delete mode 100644 libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/safe.ts delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b58.d.ts delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b58.js delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b58.js.map delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b64.d.ts delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b64.js delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b64.js.map delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/bin.d.ts delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/bin.js delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/bin.js.map delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/faert.d.ts delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/faert.js delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/faert.js.map delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/rlp.d.ts delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/rlp.js delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/rlp.js.map delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/safe.d.ts delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/safe.js delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/safe.js.map delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/b58.ts delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/b64.ts delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/bin.ts delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/faert.ts delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/rlp.ts delete mode 100644 libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/safe.ts delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b58.d.ts delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b58.js delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b58.js.map delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b64.d.ts delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b64.js delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b64.js.map delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/bin.d.ts delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/bin.js delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/bin.js.map delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/faert.d.ts delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/faert.js delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/faert.js.map delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/rlp.d.ts delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/rlp.js delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/rlp.js.map delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/safe.d.ts delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/safe.js delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/safe.js.map delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/b58.ts delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/b64.ts delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/bin.ts delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/faert.ts delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/rlp.ts delete mode 100644 libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/safe.ts diff --git a/libs/vdk_tests_cases/.gitignore b/libs/vdk_tests_cases/.gitignore new file mode 100644 index 0000000..94d69fe --- /dev/null +++ b/libs/vdk_tests_cases/.gitignore @@ -0,0 +1,4 @@ +src/jex_include +jex_mindist +dist +docs diff --git a/libs/vdk_tests_cases/dist/cases.d.ts b/libs/vdk_tests_cases/dist/cases.d.ts index 3f9a08c..9567eb8 100644 --- a/libs/vdk_tests_cases/dist/cases.d.ts +++ b/libs/vdk_tests_cases/dist/cases.d.ts @@ -1,5 +1,5 @@ export declare const rlp: { - decoded: import("./jex_include/local-vdk-0.1.0/dist/rlp.js").decoded_data; + decoded: import("./jex_include/local-vdk_rlp-0.1.0/dist/vdk_rlp.js").decoded_data; encoded: Uint8Array; }[]; export declare const base58: { diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b58.d.ts b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b58.d.ts deleted file mode 100644 index ce46968..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b58.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Base58 encoding/decoding - */ -export { encode, decode }; -/** - * Encode a Uint8Array into base58 - */ -declare function encode(binary: Uint8Array): string; -/** - * Decode a Base58 string into a Uint8Array - */ -declare function decode(base58: string): Uint8Array; diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b58.js b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b58.js deleted file mode 100644 index e8a7064..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b58.js +++ /dev/null @@ -1,308 +0,0 @@ -/** - * Base58 encoding/decoding - */ -export { encode, decode }; -//============================================================================= -// ENCODING -//============================================================================= -/** - * Encode a Uint8Array into base58 - */ -function encode(binary) { - let num_leading_zeros = nlz(binary); - let rest = binary.slice(num_leading_zeros); - let ones = encode_zeros(num_leading_zeros); - let rest_b58 = encode_rest(rest); - let result = ones + rest_b58; - return result; -} -/** - * count the number of leading zeros in a uint8array - * - * @internal - */ -function nlz(bytes) { - let n = 0; - for (let this_byte of bytes) { - if (0 === this_byte) { - n++; - } - else { - break; - } - } - return n; -} -/** - * Generate a bunch of '1's for however many leading zeros there are - * - * @internal - */ -function encode_zeros(how_many) { - let ones = ''; - for (let i = 1; i <= how_many; i++) { - ones += '1'; - } - return ones; -} -/** - * Encode a Uint8Array that has no leading zeros - * - * @internal - */ -function encode_rest(bytes) { - let bytes_bignum = bytes_to_bigint(bytes); - let result = bignum_to_base58(bytes_bignum); - return result; -} -/** - * Convert a bytestring to a bignum - * - * @internal - */ -function bytes_to_bigint(bytes) { - let acc_bigint = 0n; - for (let this_byte of bytes) { - acc_bigint <<= 8n; - acc_bigint += BigInt(this_byte); - } - return acc_bigint; -} -/** - * Convert a BigInt to Base58 - * - * @internal - */ -function bignum_to_base58(q) { - let s = ''; - while (q !== 0n) { - let this_n = q % 58n; - q /= 58n; - let this_b58_char = bigint_to_char(this_n); - s = this_b58_char + s; - } - return s; -} -//============================================================================= -// DECODING -//============================================================================= -/** - * Decode a Base58 string into a Uint8Array - */ -function decode(base58) { - let num_leading_ones = nlo(base58); - let rest = base58.slice(num_leading_ones); - let zeros = decode_ones(num_leading_ones); - let rest_arr = decode_rest(rest); - let pre_result = zeros.concat(rest_arr); - return new Uint8Array(pre_result); -} -/** - * count the number of leading 1 characters in a uint8array - * - * @internal - */ -function nlo(base58) { - let n = 0; - for (let this_char of base58) { - if ('1' === this_char) { - n++; - } - else { - break; - } - } - return n; -} -/** - * Generate a bunch of '0's for however many leading ones there are - * - * @internal - */ -function decode_ones(how_many) { - let zeros = []; - for (let i = 1; i <= how_many; i++) { - zeros.push(0); - } - return zeros; -} -/** - * Decode a string that has no leading 1s - * - * @internal - */ -function decode_rest(base58) { - let result_bignum = base58_to_bigint(base58); - let result = bigint_to_base256(result_bignum); - return result; -} -/** - * Convert a base58 string to a bignum - * - * @internal - */ -function base58_to_bigint(base58) { - let acc_bigint = 0n; - for (let this_char of base58) { - acc_bigint *= 58n; - acc_bigint += char_to_bigint(this_char); - } - return acc_bigint; -} -/** - * convert a bignum into a byte array - * - * @end - */ -function bigint_to_base256(q) { - let arr_reverse = []; - while (q !== 0n) { - let r = Number(q % 256n); - q /= 256n; - arr_reverse.push(r); - } - arr_reverse.reverse(); - return arr_reverse; -} -//============================================================================= -// TRANSLATION TABLES -//============================================================================= -/** - * Base58 integer -> character conversion table - * - * @internal - */ -function bigint_to_char(n) { - switch (n) { - case 0n: return '1'; - case 1n: return '2'; - case 2n: return '3'; - case 3n: return '4'; - case 4n: return '5'; - case 5n: return '6'; - case 6n: return '7'; - case 7n: return '8'; - case 8n: return '9'; - case 9n: return 'A'; - case 10n: return 'B'; - case 11n: return 'C'; - case 12n: return 'D'; - case 13n: return 'E'; - case 14n: return 'F'; - case 15n: return 'G'; - case 16n: return 'H'; - case 17n: return 'J'; - case 18n: return 'K'; - case 19n: return 'L'; - case 20n: return 'M'; - case 21n: return 'N'; - case 22n: return 'P'; - case 23n: return 'Q'; - case 24n: return 'R'; - case 25n: return 'S'; - case 26n: return 'T'; - case 27n: return 'U'; - case 28n: return 'V'; - case 29n: return 'W'; - case 30n: return 'X'; - case 31n: return 'Y'; - case 32n: return 'Z'; - case 33n: return 'a'; - case 34n: return 'b'; - case 35n: return 'c'; - case 36n: return 'd'; - case 37n: return 'e'; - case 38n: return 'f'; - case 39n: return 'g'; - case 40n: return 'h'; - case 41n: return 'i'; - case 42n: return 'j'; - case 43n: return 'k'; - case 44n: return 'm'; - case 45n: return 'n'; - case 46n: return 'o'; - case 47n: return 'p'; - case 48n: return 'q'; - case 49n: return 'r'; - case 50n: return 's'; - case 51n: return 't'; - case 52n: return 'u'; - case 53n: return 'v'; - case 54n: return 'w'; - case 55n: return 'x'; - case 56n: return 'y'; - case 57n: return 'z'; - default: - throw new Error('invalid base58 bigint: ' + n); - } -} -/** - * Base58 character -> integer conversion table - * - * @internal - */ -function char_to_bigint(s) { - switch (s) { - case '1': return 0n; - case '2': return 1n; - case '3': return 2n; - case '4': return 3n; - case '5': return 4n; - case '6': return 5n; - case '7': return 6n; - case '8': return 7n; - case '9': return 8n; - case 'A': return 9n; - case 'B': return 10n; - case 'C': return 11n; - case 'D': return 12n; - case 'E': return 13n; - case 'F': return 14n; - case 'G': return 15n; - case 'H': return 16n; - case 'J': return 17n; - case 'K': return 18n; - case 'L': return 19n; - case 'M': return 20n; - case 'N': return 21n; - case 'P': return 22n; - case 'Q': return 23n; - case 'R': return 24n; - case 'S': return 25n; - case 'T': return 26n; - case 'U': return 27n; - case 'V': return 28n; - case 'W': return 29n; - case 'X': return 30n; - case 'Y': return 31n; - case 'Z': return 32n; - case 'a': return 33n; - case 'b': return 34n; - case 'c': return 35n; - case 'd': return 36n; - case 'e': return 37n; - case 'f': return 38n; - case 'g': return 39n; - case 'h': return 40n; - case 'i': return 41n; - case 'j': return 42n; - case 'k': return 43n; - case 'm': return 44n; - case 'n': return 45n; - case 'o': return 46n; - case 'p': return 47n; - case 'q': return 48n; - case 'r': return 49n; - case 's': return 50n; - case 't': return 51n; - case 'u': return 52n; - case 'v': return 53n; - case 'w': return 54n; - case 'x': return 55n; - case 'y': return 56n; - case 'z': return 57n; - default: - throw new Error('invalid base58 char: ' + s); - } -} -//# sourceMappingURL=b58.js.map \ No newline at end of file diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b58.js.map b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b58.js.map deleted file mode 100644 index c93be14..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b58.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"b58.js","sourceRoot":"","sources":["../src/b58.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACH,MAAM,EACN,MAAM,EACT,CAAA;AAID,+EAA+E;AAC/E,WAAW;AACX,+EAA+E;AAE/E;;GAEG;AACH,SACA,MAAM,CACD,MAAmB;IAGpB,IAAI,iBAAiB,GAAgB,GAAG,CAAC,MAAM,CAAC,CAAC;IACjD,IAAI,IAAI,GAA6B,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrE,IAAI,IAAI,GAA6B,YAAY,CAAC,iBAAiB,CAAC,CAAC;IACrE,IAAI,QAAQ,GAAyB,WAAW,CAAC,IAAI,CAAC,CAAC;IACvD,IAAI,MAAM,GAA2B,IAAI,GAAG,QAAQ,CAAC;IACrD,OAAO,MAAM,CAAC;AAClB,CAAC;AAID;;;;GAIG;AACH,SACA,GAAG,CACE,KAAiB;IAGlB,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,KAAK,IAAI,SAAS,IAAI,KAAK,EAC3B;QACI,IAAI,CAAC,KAAK,SAAS,EAAE;YAAE,CAAC,EAAE,CAAC;SAAI;aACV;YAAE,MAAM;SAAE;KAClC;IACD,OAAO,CAAC,CAAC;AACb,CAAC;AAID;;;;GAIG;AACH,SACA,YAAY,CACP,QAAiB;IAGlB,IAAI,IAAI,GAAY,EAAE,CAAC;IACvB,KAAK,IAAI,CAAC,GAAI,CAAC,EACN,CAAC,IAAI,QAAQ,EACb,CAAC,EAAE,EACZ;QACI,IAAI,IAAI,GAAG,CAAC;KACf;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAID;;;;GAIG;AACH,SACA,WAAW,CACN,KAAkB;IAGnB,IAAI,YAAY,GAAY,eAAe,CAAC,KAAK,CAAC,CAAC;IACnD,IAAI,MAA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O,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB;YACI,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,CAAC,CAAC,CAAC;KACpD;AACL,CAAC"} \ No newline at end of file diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b64.d.ts b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b64.d.ts deleted file mode 100644 index 6a91552..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b64.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Base64 Utility Functions in TypeScript - */ -export { encode, decode }; -/** - * Encode an array of bytes as a Uint8Array in base64 notation. - */ -declare function encode(bytes: Uint8Array): string; -/** - * Decode a base64-encoded string - */ -declare function decode(base64_str: string): Uint8Array; diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b64.js b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b64.js deleted file mode 100644 index a7f7fc5..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b64.js +++ /dev/null @@ -1,507 +0,0 @@ -/** - * Base64 Utility Functions in TypeScript - */ -export { encode, decode }; -/** - * Encode an array of bytes as a Uint8Array in base64 notation. - */ -function encode(bytes) { - // slice the array - // length of head is a multiple of 3 - // treat the tail as a special case - let { head, tail, tail_len } = slice3k(bytes); - let head_str = encode_head(head); - let tail_str = encode_tail(tail, tail_len); - return head_str + tail_str; -} -/** - * Take a Uint8Array, take the first 3k (k >= 0) bytes, put them in head, and - * the remaining 0,1, or 2 bytes, put them in tail - * - * @internal - */ -function slice3k(bytes) { - let len = bytes.length; - // too lazy to look up how to do integer division in js so this will do - let tail_len = len % 3; - let head_len = len - tail_len; - // for slice: - // first argument is the 0-index of the start - // second - first is the length of the slice - let head = bytes.slice(0, head_len); - // empty second argument means go to the end - let tail = bytes.slice(head_len); - return { head: head, - tail: tail, - tail_len: tail_len }; -} -/** - * Encode a Uint8Array whose length is known to be a multiple of 3 - * - * @internal - */ -function encode_head(head_bytes) { - // can assume length of bytes is a multiple of 3 - // start index at 0 - // increment by 3 - let head_bytes_len = head_bytes.length; - let max_idx0 = head_bytes_len - 1; - let head_str_acc = ''; - for (let this_3slice_start_idx0 = 0; this_3slice_start_idx0 <= max_idx0; this_3slice_start_idx0 += 3) { - let this_3slice_bytes = head_bytes.slice(this_3slice_start_idx0, this_3slice_start_idx0 + 3); - let this_3slice_str = encode3(this_3slice_bytes); - head_str_acc += this_3slice_str; - } - return head_str_acc; -} -/** - * Encode a 3 bytes into base64 notation - * - * @internal - */ -function encode3(bytes) { - let b0 = bytes[0]; - let b1 = bytes[1]; - let b2 = bytes[2]; - // ABCDEFGH 12345678 abcdefgh - // b0 b1 b2 - // ABCDEF GH1234 5678ab cdefgh - // n0 n1 n2 n3 - let n0 = b0 >> 2; - // b0 = ABCDEFGH - // 4 = _____1__ - // b0 % 4 = ______GH - // (b0 % 4) << 4 = __GH____ - // b1 = 12345678 - // b1 >> 4 = ____1234 - // n1 = __GH1234 - let n1 = ((b0 % 4) << 4) + (b1 >> 4); - // b1 = 12345678 - // 16 = ___1____ - // b1 % 16 = ____5678 - // (b1 % 16) << 2 = __5678__ - // b2 = abcdefgh - // b2 >> 6 = ______ab - // n2 = __5678ab - let n2 = ((b1 % 16) << 2) + (b2 >> 6); - // b2 = abcdefgh - // 64 = _1______ - // n3 = __cdefgh - let n3 = b2 % 64; - // convert to chars - let s0 = int2char(n0); - let s1 = int2char(n1); - let s2 = int2char(n2); - let s3 = int2char(n3); - // retrvn - return s0 + s1 + s2 + s3; -} -/** - * Encode the final 0, 1, or 2 bytes - * - * @internal - */ -function encode_tail(tail_bytes, tail_len) { - switch (tail_len) { - case 0: return ''; - case 1: return encode1(tail_bytes); - case 2: return encode2(tail_bytes); - default: - throw new Error('encode_tail with tail_len = ' + tail_len); - } -} -/** - * Encode a single byte - * - * @internal - */ -function encode1(bytes) { - let b0 = bytes[0]; - // n0 = __ABCDEF - // b0 = ABCDEFGH - // b0 >> 2 = __ABCDEF - let n0 = b0 >> 2; - // n1 = __GH____ - // b0 = ABCDEFGH - // 4 = _____1__ - // b0 % 4 = ______GH - // (b0 % 4) << 4 = __GH____ - let n1 = (b0 % 4) << 4; - return int2char(n0) + int2char(n1) + '=='; -} -/** - * Encode two bytes - * - * @internal - */ -function encode2(bytes) { - let b0 = bytes[0]; - let b1 = bytes[1]; - // ABCDEFGH 12345678 - // b0 b1 - // ABCDEF GH1234 5678__ - // n0 n1 n2 - let n0 = b0 >> 2; - // b0 = ABCDEFGH - // 4 = _____1__ - // b0 % 4 = ______GH - // (b0 % 4) << 4 = __GH____ - // b1 = 12345678 - // b1 >> 4 = ____1234 - // n1 = __GH1234 - let n1 = ((b0 % 4) << 4) + (b1 >> 4); - // b1 = 12345678 - // 16 = ___1____ - // b1 % 16 = ____5678 - // (b1 % 16) << 2 = __5678__ - // n2 = __5678__ - let n2 = (b1 % 16) << 2; - // convert to chars - let s0 = int2char(n0); - let s1 = int2char(n1); - let s2 = int2char(n2); - // retrvn - return s0 + s1 + s2 + '='; -} -/** - * Decode a base64-encoded string - */ -function decode(base64_str) { - // length of the string is guaranteed to be a multiple of 4 - // if the string is empty, return the empty array - let len = base64_str.length; - // this branching contains the implicit assertion that the length is a - // multiple of 4. If this is not true, the bottom branch is triggered. - // general case goes first because speeeeeed - if ((4 < len) - && (0 === (len % 4))) { - // split the head and tail - let tail_start_idx0 = len - 4; - let head_s = base64_str.slice(0, tail_start_idx0); - let tail_s = base64_str.slice(tail_start_idx0); - // Using arrays because Uint8Arrays don't have a concat operation - let head_arr = decode_head(head_s); - let tail_arr = decode_tail(tail_s); - // silly to put these in variables but this is exactly the type of - // situation where JS type insanity shows up - // - // see: i forgot - // > [1,2,3] + [4,5,6] - // '1,2,34,5,6' - // - // Originally, I used + like some sort of moron who codes in a sane - // language - // - // seriously what is this language - // - // this is some clown behavior - let total_arr = head_arr.concat(tail_arr); - return new Uint8Array(total_arr); - } - // special case if the length is exactly 4 - else if (4 === len) { - // it's just a tail - return new Uint8Array(decode_tail(base64_str)); - } - // empty string - else if (0 === len) { - return new Uint8Array([]); - } - else { - throw new Error('base64 decode: invalid string length: ' + len); - } -} -/** - * Decode a string known to not have any padding - * - * @internal - */ -function decode_head(s) { - // go 4 characters at a time - let max_i0 = s.length - 1; - let decoded_acc = []; - for (let i0 = 0; i0 <= max_i0; i0 += 4) { - let this_slice_s = s.slice(i0, i0 + 4); - let this_slice_arr = decode3(this_slice_s); - // update accumulator - decoded_acc = decoded_acc.concat(this_slice_arr); - } - return decoded_acc; -} -/** - * Decode 4 characters that correspond to either 3 bytes, 2, bytes, or 1 byte - * - * @internal - */ -function decode_tail(s) { - // all that matters right now is the last 2 chars - // s0, s1, s2, s3 - // 0 based indexing is so annoying - let s2 = s[2]; - let s3 = s[3]; - // braaaaaaaaaaaaaaaaaench - // two equals signs means 1 byte - if (('=' === s3) && ('=' === s2)) { - return decode1(s); - } - // one equals sign means 2 bytes - else if (('=' === s3)) { - return decode2(s); - } - // 0 equals signs means 3 bytes - else { - return decode3(s); - } -} -/** - * Decode a 4-character long base64 string corresponding to 3 bytes - * - * @internal - */ -function decode3(s) { - // pull out strings - let s0 = s[0]; - let s1 = s[1]; - let s2 = s[2]; - let s3 = s[3]; - // convert to numbers - let n0 = char2int(s0); - let n1 = char2int(s1); - let n2 = char2int(s2); - let n3 = char2int(s3); - // abcdef gh1234 5678ab cdefgh - // n0 n1 n2 n3 - // abcdefgh 12345678 abcdefgh - // b0 b1 b2 - // n0 = __abcdef - // n1 = __gh1234 - // n0 << 2 = abcdef__ - // n1 >> 4 = ______gh - // b0 = abcdefgh - let b0 = (n0 << 2) + (n1 >> 4); - // n1 = __gh1234 - // 16 = ___1____ - // n1 % 16 = ____1234 - // (n1 % 16) << 4 = 1234____ - // n2 = __5678ab - // n2 >> 2 = ____5678 - // b1 = 12345678 - let b1 = ((n1 % 16) << 4) + (n2 >> 2); - // n2 = __5678ab - // 4 = _____1__ - // n2 % 4 = ______ab - // (n2 % 4) << 6 = ab______ - // n3 = __cdefgh - let b2 = ((n2 % 4) << 6) + n3; - return [b0, b1, b2]; -} -/** - * Decode a 4-character long base64 string corresponding to 2 bytes - * - * @internal - */ -function decode2(s) { - // xyz= - // pull out strings - let s0 = s[0]; - let s1 = s[1]; - let s2 = s[2]; - // convert to numbers - let n0 = char2int(s0); - let n1 = char2int(s1); - let n2 = char2int(s2); - // abcdef gh1234 5678__ - // n0 n1 n2 - // abcdefgh 12345678 - // b0 b1 - // n0 = __abcdef - // n1 = __gh1234 - // n0 << 2 = abcdef__ - // n1 >> 4 = ______gh - // b0 = abcdefgh - let b0 = (n0 << 2) + (n1 >> 4); - // n1 = __gh1234 - // 16 = ___1____ - // n1 % 16 = ____1234 - // (n1 % 16) << 4 = 1234____ - // n2 = __5678__ - // n2 >> 2 = ____5678 - // b1 = 12345678 - let b1 = ((n1 % 16) << 4) + (n2 >> 2); - return [b0, b1]; -} -/** - * Decode a 4-character long base64 string corresponding to 2 bytes - * - * @internal - */ -function decode1(s) { - // xy== - // pull out strings - let s0 = s[0]; - let s1 = s[1]; - // convert to numbers - let n0 = char2int(s0); - let n1 = char2int(s1); - // abcdef gh____ - // n0 n1 - // abcdefgh - // b0 - // n0 = __abcdef - // n1 = __gh____ - // n0 << 2 = abcdef__ - // n1 >> 4 = ______gh - // b0 = abcdefgh - let b0 = (n0 << 2) + (n1 >> 4); - return [b0]; -} -// FIXME: these tables would *probably* be faster if they were made into objects -/** - * Conversion table for base64 encode - * - * @internal - */ -function int2char(n) { - switch (n) { - case 0: return 'A'; - case 1: return 'B'; - case 2: return 'C'; - case 3: return 'D'; - case 4: return 'E'; - case 5: return 'F'; - case 6: return 'G'; - case 7: return 'H'; - case 8: return 'I'; - case 9: return 'J'; - case 10: return 'K'; - case 11: return 'L'; - case 12: return 'M'; - case 13: return 'N'; - case 14: return 'O'; - case 15: return 'P'; - case 16: return 'Q'; - case 17: return 'R'; - case 18: return 'S'; - case 19: return 'T'; - case 20: return 'U'; - case 21: return 'V'; - case 22: return 'W'; - case 23: return 'X'; - case 24: return 'Y'; - case 25: return 'Z'; - case 26: return 'a'; - case 27: return 'b'; - case 28: return 'c'; - case 29: return 'd'; - case 30: return 'e'; - case 31: return 'f'; - case 32: return 'g'; - case 33: return 'h'; - case 34: return 'i'; - case 35: return 'j'; - case 36: return 'k'; - case 37: return 'l'; - case 38: return 'm'; - case 39: return 'n'; - case 40: return 'o'; - case 41: return 'p'; - case 42: return 'q'; - case 43: return 'r'; - case 44: return 's'; - case 45: return 't'; - case 46: return 'u'; - case 47: return 'v'; - case 48: return 'w'; - case 49: return 'x'; - case 50: return 'y'; - case 51: return 'z'; - case 52: return '0'; - case 53: return '1'; - case 54: return '2'; - case 55: return '3'; - case 56: return '4'; - case 57: return '5'; - case 58: return '6'; - case 59: return '7'; - case 60: return '8'; - case 61: return '9'; - case 62: return '+'; - case 63: return '/'; - default: throw new Error("invalid base64 encode byte: " + n); - } -} -/** - * Conversion table for base64 decode - * - * @internal - */ -function char2int(s) { - switch (s) { - case 'A': return 0; - case 'B': return 1; - case 'C': return 2; - case 'D': return 3; - case 'E': return 4; - case 'F': return 5; - case 'G': return 6; - case 'H': return 7; - case 'I': return 8; - case 'J': return 9; - case 'K': return 10; - case 'L': return 11; - case 'M': return 12; - case 'N': return 13; - case 'O': return 14; - case 'P': return 15; - case 'Q': return 16; - case 'R': return 17; - case 'S': return 18; - case 'T': return 19; - case 'U': return 20; - case 'V': return 21; - case 'W': return 22; - case 'X': return 23; - case 'Y': return 24; - case 'Z': return 25; - case 'a': return 26; - case 'b': return 27; - case 'c': return 28; - case 'd': return 29; - case 'e': return 30; - case 'f': return 31; - case 'g': return 32; - case 'h': return 33; - case 'i': return 34; - case 'j': return 35; - case 'k': return 36; - case 'l': return 37; - case 'm': return 38; - case 'n': return 39; - case 'o': return 40; - case 'p': return 41; - case 'q': return 42; - case 'r': return 43; - case 's': return 44; - case 't': return 45; - case 'u': return 46; - case 'v': return 47; - case 'w': return 48; - case 'x': return 49; - case 'y': return 50; - case 'z': return 51; - case '0': return 52; - case '1': return 53; - case '2': return 54; - case '3': return 55; - case '4': return 56; - case '5': return 57; - case '6': return 58; - case '7': return 59; - case '8': return 60; - case '9': return 61; - case '+': return 62; - case '/': return 63; - default: throw new Error("invalid base64 character: " + s); - } -} -//# sourceMappingURL=b64.js.map \ No newline at end of file diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b64.js.map b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/b64.js.map deleted file mode 100644 index 7398ad3..0000000 --- a/libs/vdk_tests_cases/dist/jex_include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AC"} \ No newline at end of file diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/bin.d.ts b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/bin.d.ts deleted file mode 100644 index 915e4ce..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/bin.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Miscellaneous binary utility functions - * - * @module - */ -export { bytes_to_bigint, bigint_to_bytes, concat, strong_rand_bytes }; -/** - * Concatenate two arrays - */ -declare function concat(arr1: Uint8Array, arr2: Uint8Array): Uint8Array; -/** - * Cryptographically random bytes - */ -declare function strong_rand_bytes(how_many: number): Uint8Array; -/** - * Convert a byte array to a bigint - * - * Equivalent to `binary:decode_unsigned/1` from Erlang - */ -declare function bytes_to_bigint(bytes: Uint8Array): bigint; -/** - * Convert a bigint to a byte array - * - * Equivalent to `binary:encode_unsigned/1` from Erlang - * - * Requires input to be positive - */ -declare function bigint_to_bytes(q: bigint): Uint8Array; diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/bin.js b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/bin.js deleted file mode 100644 index 2841b74..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/bin.js +++ /dev/null @@ -1,266 +0,0 @@ -/** - * Miscellaneous binary utility functions - * - * @module - */ -export { bytes_to_bigint, bigint_to_bytes, concat, strong_rand_bytes }; -/** - * Concatenate two arrays - */ -function concat(arr1, arr2) { - let len1 = arr1.length; - let len2 = arr2.length; - let arr1_idx0_offset = 0; - let arr2_idx0_offset = len1; - let result_len = len1 + len2; - let result = new Uint8Array(result_len); - // copy first array into result - for (let arr1_idx0 = 0; arr1_idx0 < len1; arr1_idx0++) { - // no offset here - let result_idx0 = arr1_idx0 + arr1_idx0_offset; - result[result_idx0] = arr1[arr1_idx0]; - } - // copy second array into result - for (let arr2_idx0 = 0; arr2_idx0 < len2; arr2_idx0++) { - // offset by the length of the first array - let result_idx0 = arr2_idx0 + arr2_idx0_offset; - result[result_idx0] = arr2[arr2_idx0]; - } - return result; -} -/** - * Cryptographically random bytes - */ -function strong_rand_bytes(how_many) { - let arr = new Uint8Array(how_many); - (new Crypto()).getRandomValues(arr); - return arr; -} -/** - * Convert a byte array to a bigint - * - * Equivalent to `binary:decode_unsigned/1` from Erlang - */ -function bytes_to_bigint(bytes) { - let n = 0n; - for (let b of bytes) { - // move first, then add - // otherwise it ends on a move - // imperative languages are for losers - n <<= 8n; - n += BigInt(b); - } - return n; -} -/** - * Convert a bigint to a byte array - * - * Equivalent to `binary:encode_unsigned/1` from Erlang - * - * Requires input to be positive - */ -function bigint_to_bytes(q) { - if (q < 0n) { - throw new Error('q < 0n: ' + q); - } - let arr_reverse = []; - while (q > 0n) { - let r = Number(q % 256n); - q /= 256n; - arr_reverse.push(r); - } - arr_reverse.reverse(); - return new Uint8Array(arr_reverse); -} -/** - * Get an uninitialized bitstring - * - * @internal - */ -function bits_null(bit_length) { - let byte_length = Math.ceil(bit_length / 8); - let result = new Uint8Array(byte_length); - return { bit_length: bit_length, - bytes: result }; -} -/** - * Get a bitstring of a given length where every value is 0. - */ -function bits_zeros(bit_length) { - let byte_length = Math.ceil(bit_length / 8); - let result = new Uint8Array(byte_length); - for (let i0 = 0; i0 < byte_length; i0++) { - result[i0] = 0; - } - return { bit_length: bit_length, - bytes: result }; -} -/** - * Get a bitstring of a given length where every value is 1. - */ -function bits_ones(bit_length) { - let byte_length = Math.ceil(bit_length / 8); - let result = new Uint8Array(byte_length); - // fill everything except the last byte with 255s - for (let i0 = 0; i0 < (byte_length - 1); i0++) { - result[i0] = 255; - } - // alright so the last byte - // ok so the number of leading 0s is - // 8 - (bit_length % 8) - let num_trailing_zero_bits = 8 - (bit_length % 8); - // the trailing byte is 255 << that - // e.g. 3 trailing 0s - // 1111_1111 -> 1111_1000 - let last_byte = 255 << num_trailing_zero_bits; - let last_byte_idx0 = byte_length - 1; - result[last_byte_idx0] = last_byte; - return { bit_length: bit_length, - bytes: result }; -} -/** - * Get the bit at a given 0-index - */ -function bits_i0th(bit_idx0, bits) { - // first task is figuring out what byte we're at - // for instance if we want bit 27 - // 3*8 = 24 =< 27 < 4*8 - // so it's Math.floor(bit_idx0 / 8) - let byte_idx0 = Math.floor(bit_idx0 / 8); - // let's fetch the byte and work with that - let the_byte = bits.bytes[byte_idx0]; - // ok so let's go with 27 again - // 27 = 3 mod 8 - // so we bitshift right by (8 - 3) - // and then take the remainder dividing by 2 - // --B-_---- -> ----_---B -> 0000_000B - let bsr = 8 - (bit_idx0 % 8); - return (the_byte >> bsr) % 2; -} -/** - * Concatenate two bitstrings - */ -function bits_concat(bits1, bits2) { - let result_bit_length = bits1.bit_length + bits2.bit_length; - let bytes1 = bits1.bytes; - let bytes2 = bits2.bytes; - // using zeros here because of our xor trick in a minute - let result_bits = bits_null(result_bit_length); - let result_bytes = result_bits.bytes; - // go along each byte in result, and compute the byte boundary - for (let i = 0; i < result_bytes.length; i++) { - // ABCD_EFGH _ - // 0123_4567 8 - // this is the bit index of the leftmost bit in this byte - let start_bit_bi0 = i * 8; - let next_start_bit_bi0 = start_bit_bi0 + 8; - // does the bit at the beginning of this byte correspond to the first array? - // strict comparison: - // suppose i = 0, - // suppose bit_length1 is 0 - // then this says no, go to second array - // suppose bl1 = 1, - // this says start at first array - let start_bit_is_of_first_array = start_bit_bi0 < bits1.bit_length; - // weak comparison: - // suppose bit_length1 = 8 - // ABCD_EFGH _ - // 0123_4567 8 - // ^ - // start_bit_bi0 ^ next_start_bit_bi0 - let stop_bit_is_of_first_array = next_start_bit_bi0 <= bits1.bit_length; - // is this a bytes1 byte - let is_bytes1_byte = start_bit_is_of_first_array && stop_bit_is_of_first_array; - let is_boundary_byte = start_bit_is_of_first_array && !stop_bit_is_of_first_array; - // need to work out the ping_pong bs up here because js is dumb and I - // can't put lets between elseifs - // alright, now we're in the case of only copying from the second array - // we have two cases: - // ping-pong: - // ABCD_EFGH 1234_5678 - // - ---- --- - // copying these bits - // ping: - // ABCD_EFGH - // - ---- 000 - // - // how to distinguish between these two?? - // - // we're in the ping case when the start_bit_bi0 corresponds to the - // final byte of the second array - // - // ok - // - // we need to compute the bit address in the second array that - // corresponds to the bit address at the beginning of this byte in the - // result array - let bits2_addr_bi0 = start_bit_bi0 - bits1.bit_length; - // I think the variable is - // bits_left_to_copy = bits2.bit_length - bit_addr2_bi0 - // no + 1 because the current bit is uncopied, - // so if bit_addr2_bi0 = 7 and bits2.bit_length is 8, it means we - // have the last bit to copy - // cases: - // bits_left_to_copy <= 0 -> - // this would mean we have more bits to copy, but are out of - // source bits. should be impossible if bits_null is correct - // bits_left_to_copy <= 8 -> - // this would mean we are going to fill this last byte in the - // result array with the correct bits from array2, but how we - // do this will depend on how those are arranged in bytes2 - // (whether we grab one or two bytes) - // - // this is the tricky case - // - // I think what matters here is the byte address in the second array - // if we're on the last byte - // 8 < bits_left_to_copy -> - // this means we can safely grab two bytes from bytes2, and do - // our bitshifting to make it correct - // - // FIXME - let bits_left_to_copy = bits2.bit_length - bits2_addr_bi0; - // no the variable that matters is which byte we're on in the result - let this_bytes2_addr_i0 = Math.floor(bits2_addr_bi0 / 8); - let next_bytes2_addr_i0 = this_bytes2_addr_i0 + 1; - let bitshift_amt = bits1.bit_length % 8; - let ping = next_bytes2_addr_i0 === bytes2.length; - // simple case: this is a byte from the first array - // just copy it - if (is_bytes1_byte) - result_bytes[i] = bytes1[i]; - // this is a boundary byte - // further cases: - // second bit length is 0 -> - // ABCD_EF-- - // ^ starting here - // just copy first byte and move along - else if (is_boundary_byte && (bits2.bit_length === 0)) - result_bytes[i] = bytes1[i]; - // boundary byte, and there is at least one byte in the second array - else if (is_boundary_byte) { - // copy over the first byte - result_bytes[i] = bytes1[i]; - // take the first byte from the second array - let first_byte_of_second_array = bytes2[0]; - // bytes1: - // ABCD_EF00 - // 6 - // bytes2: - // 1234_5678 - // 0000_0012 - // and bitshift it right by that amount - let bitshift_amt = bits1.bit_length % 8; - result_bytes[i] ^= first_byte_of_second_array >> bitshift_amt; - } - // last byte of second array - else if (ping) - result_bytes[i] = (bytes2[this_bytes2_addr_i0] << bitshift_amt); - // ping-pong: not last byte of second array - else - result_bytes[i] = (bytes2[this_bytes2_addr_i0] << bitshift_amt) ^ (bytes2[next_bytes2_addr_i0] << bitshift_amt); - } - return { bit_length: result_bit_length, - bytes: result_bytes }; -} -//# sourceMappingURL=bin.js.map \ No newline at end of file diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/bin.js.map b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/bin.js.map deleted file mode 100644 index a87fc4d..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/bin.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACH,eAAe,EACf,eAAe,EACf,MAAM,EACN,iBAAiB,EACpB,CAAC;AAIF;;GAEG;AACH,SACA,MAAM,CACD,IAAiB,EACjB,IAAiB;IAGlB,IAAI,IAAI,GAA4B,IAAI,CAAC,MAAM,CAAC;IAChD,IAAI,IAAI,GAA4B,IAAI,CAAC,MAAM,CAAC;IAChD,IAAI,gBAAgB,GAAgB,CAAC,CAAC;IACtC,IAAI,gBAAgB,GAAgB,IAAI,CAAC;IACzC,IAAI,UAAU,GAAsB,IAAI,GAAG,IAAI,CAAC;IAChD,IAAI,MAAM,GAA0B,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;IAC/D,+BAA+B;IAC/B,KAAK,IAAI,SAAS,GAAG,CAAC,EACb,SAAS,GAAG,IAAI,EAChB,SAAS,EAAE,EACpB;QACI,iBAAiB;QACjB,IAAI,WAAW,GAAY,SAAS,GAAG,gBAAgB,CAAC;QACxD,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,SAAS,CAA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GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,YAAY,CAAC,CAAC;KACvH;IAED,OAAO,EAAC,UAAU,EAAG,iBAAiB;QAC9B,KAAK,EAAQ,YAAY,EAAC,CAAC;AAEvC,CAAC"} \ No newline at end of file diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/faert.d.ts b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/faert.d.ts deleted file mode 100644 index fca75f5..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/faert.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * FÆRT: Fast Æternity Recovery Text - * - * Reference: https://gitlab.com/zxq9/passgas/-/blob/83607fedb08be5dfd03210e331f9c76125bb3467/fullofbeans - * - * @module - */ -export { encode, decode, byte_of_word, check_word, check_byte, words }; -import * as safe from './safe.js'; -/** - * Encode a bytestring into FÆRT - */ -declare function encode(bytes: Uint8Array): string; -/** - * Decode a FAERT string into bytes - */ -declare function decode(faert: string): safe.Safe; -/** - * given a word, find its index - */ -declare function byte_of_word(word: string): safe.Safe; -/** - * compute the check word of an array - */ -declare function check_word(bytes: Uint8Array): string; -/** - * given an array, compute the xor of all the bytes in the array - */ -declare function check_byte(bytes: Uint8Array): number; -declare let words: string[]; diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/faert.js b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/faert.js deleted file mode 100644 index 58a5ba3..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/faert.js +++ /dev/null @@ -1,344 +0,0 @@ -/** - * FÆRT: Fast Æternity Recovery Text - * - * Reference: https://gitlab.com/zxq9/passgas/-/blob/83607fedb08be5dfd03210e331f9c76125bb3467/fullofbeans - * - * @module - */ -export { encode, decode, byte_of_word, check_word, check_byte, words }; -import * as safe from './safe.js'; -/** - * Encode a bytestring into FÆRT - */ -function encode(bytes) { - // initial accumulator - let words_acc = []; - // go along each byte and look up the word - // add it to the accumulator - for (let this_byte of bytes) { - let this_word = words[this_byte]; - words_acc.push(this_word); - } - // prepend check word to phrase - // yes craig it would be faster to do the check byte inline - // the usage case here is 64 byte strings - // double pass is not a big deal - return check_word(bytes) + ' ' + words_acc.join(' '); -} -/** - * Decode a FAERT string into bytes - */ -function decode(faert) { - let all_words = faert.split(' '); - let input_check_word = all_words[0]; - let input_words = all_words.slice(1); - // accumulator - let computed_bytes = []; - // loop over words and figure out accumulator - for (let this_input_word of input_words) { - let maybe_this_byte = byte_of_word(this_input_word); - // if the word is an allowable word, add it to the accumulator - if (maybe_this_byte.ok) { - let this_byte = maybe_this_byte.result; - computed_bytes.push(this_byte); - } - // error case, propagate the error up the call chain - else - return maybe_this_byte; - } - // at this point, we can assume we correctly decoded all words - // compute the check byte - let computed_bytes_u8s = new Uint8Array(computed_bytes); - let computed_check_word = check_word(computed_bytes_u8s); - // check if it is correct - // if so, return the computed bytes - if (computed_check_word === input_check_word) - return safe.ok(computed_bytes_u8s); - // otherwise, return an error - else - return safe.error('checksum failure! computed check word: ' + computed_check_word + '; input check word: ' + input_check_word); -} -/** - * given a word, find its index - */ -function byte_of_word(word) { - for (let i = 0; i <= 255; i++) { - if (word === words[i]) - return safe.ok(i); - } - return safe.error('invalid word: ' + word); -} -/** - * compute the check word of an array - */ -function check_word(bytes) { - return words[check_byte(bytes)]; -} -/** - * given an array, compute the xor of all the bytes in the array - */ -function check_byte(bytes) { - let check_byte = 0; - for (let this_byte of bytes) - check_byte ^= this_byte; - return check_byte; -} -let words = [ - "able", - "abuse", - "acquire", - "adjust", - "agent", - "air", - "alert", - "alpha", - "anger", - "answer", - "any", - "argue", - "around", - "assume", - "asthma", - "aunt", - "awkward", - "balcony", - "barrel", - "because", - "behave", - "bicycle", - "bike", - "blind", - "blouse", - "bonus", - "bottom", - "breeze", - "brother", - "bubble", - "burger", - "butter", - "can", - "cannon", - "cargo", - "catalog", - "caught", - "century", - "chaos", - "chicken", - "churn", - "cinnamon", - "clever", - "clock", - "clown", - "collect", - "conduct", - "convince", - "correct", - "cradle", - "crane", - "crime", - "cross", - "crystal", - "curve", - "daughter", - "debris", - "decrease", - "deny", - "deputy", - "despair", - "diesel", - "dinner", - "distance", - "document", - "donate", - "drama", - "drink", - "dutch", - "earth", - "educate", - "elbow", - "employ", - "endless", - "enlist", - "enter", - "equal", - "eternal", - "example", - "exhibit", - "exotic", - "faculty", - "famous", - "fault", - "feature", - "fiber", - "filter", - "firm", - "flame", - "flush", - "follow", - "forward", - "frame", - "fringe", - "future", - "game", - "gate", - "gift", - "glare", - "glow", - "goat", - "grab", - "grief", - "guilt", - "hand", - "hawk", - "health", - "hen", - "hire", - "honey", - "hover", - "hurry", - "hybrid", - "impose", - "inch", - "inherit", - "injury", - "install", - "iron", - "jazz", - "joke", - "just", - "kit", - "kitchen", - "language", - "laundry", - "leader", - "lend", - "leopard", - "license", - "live", - "lobster", - "lounge", - "magnet", - "mail", - "mansion", - "mass", - "math", - "media", - "message", - "metal", - "misery", - "mix", - "more", - "mountain", - "museum", - "mutual", - "narrow", - "nerve", - "next", - "note", - "obey", - "obtain", - "offer", - "once", - "orange", - "ostrich", - "over", - "owner", - "palace", - "patch", - "pave", - "pen", - "phrase", - "piece", - "pizza", - "plunge", - "polar", - "pool", - "power", - "pretty", - "private", - "protect", - "pulp", - "purity", - "quit", - "quote", - "raise", - "razor", - "recall", - "region", - "relief", - "rent", - "rescue", - "review", - "ride", - "risk", - "roof", - "rough", - "saddle", - "salmon", - "sand", - "scene", - "scrub", - "season", - "seek", - "series", - "shed", - "shoe", - "sick", - "silent", - "situate", - "skill", - "slide", - "slush", - "snack", - "solar", - "soul", - "special", - "sphere", - "spot", - "spy", - "stairs", - "stereo", - "strategy", - "stuff", - "success", - "sunny", - "surge", - "swear", - "symptom", - "tail", - "ten", - "tent", - "theme", - "thumb", - "tiny", - "toe", - "tooth", - "topic", - "trade", - "trash", - "trophy", - "truly", - "tumble", - "typical", - "uncle", - "unfair", - "until", - "upper", - "useless", - "van", - "venue", - "video", - "visa", - "vocal", - "walk", - "waste", - "wedding", - "weekend", - "wide", - "winner", - "wise", - "wood", - "wrist", - "zero" -]; -//# sourceMappingURL=faert.js.map \ No newline at end of file diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/faert.js.map b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/faert.js.map deleted file mode 100644 index c7d5d90..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/faert.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"faert.js","sourceRoot":"","sources":["../src/faert.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACH,MAAM,EACN,MAAM,EACN,YAAY,EACZ,UAAU,EACV,UAAU,EACV,KAAK,EACR,CAAA;AAED,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAIlC;;GAEG;AACH,SACA,MAAM,CACD,KAAkB;IAGnB,sBAAsB;IACtB,IAAI,SAAS,GAAoB,EAAE,CAAC;IAEpC,0CAA0C;IAC1C,4BAA4B;IAC5B,KAAK,IAAI,SAAS,IAAI,KAAK,EAC3B;QACI,IAAI,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;QACjC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;KAC7B;IAED,+BAA+B;IAC/B,2DAA2D;IAC3D,yCAAyC;IACzC,gCAAgC;IAChC,OAAO,UAAU,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzD,CAAC;AAID;;GAEG;AACH,SACA,MAAM,CACD,KAAc;IAGf,IAAI,SAAS,GAA0B,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACxD,IAAI,gBAAgB,GAAmB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AAM;IACN,MAAM;IACN,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,MAAM;IACN,SAAS;IACT,QAAQ;IACR,MAAM;IACN,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,OAAO;IACP,SAAS;IACT,OAAO;IACP,OAAO;IACP,OAAO;IACP,SAAS;IACT,MAAM;IACN,KAAK;IACL,MAAM;IACN,OAAO;IACP,OAAO;IACP,MAAM;IACN,KAAK;IACL,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,SAAS;IACT,OAAO;IACP,QAAQ;IACR,OAAO;IACP,OAAO;IACP,SAAS;IACT,KAAK;IACL,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,SAAS;IACT,SAAS;IACT,MAAM;IACN,QAAQ;IACR,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;CACT,CAAA"} \ No newline at end of file diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/rlp.d.ts b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/rlp.d.ts deleted file mode 100644 index 2072aec..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/rlp.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Ethereum Recursive-Length Prefix Encoding implementation - * - * Two reference implementations: - * - * 1. Ethereum Python implementation - * 2. My Erlang implementation (agrees with Ethereum Python in randomized - * tests) - * - * This work can be found in ../test/testgen/ - * - * FIXME: need to have Safe assertions for "i am decoding a list", "i am - * decoding a binary", "I am decoding something with no remainder", etc - * - * @module - */ -export { decoded_data, decode_result, decode, encode }; -/** - * Data that RLP can encode. Also the result of decoding. - */ -declare type decoded_data = Uint8Array | Array; -/** - * Decoding can have a remainder - */ -declare type decode_result = { - decoded_data: decoded_data; - remainder: Uint8Array; -}; -/** - * Decode an RLP-encoded bytestring into a `decode_result` (decoded data + - * whatever wasn't consumed) - */ -declare function decode(bytes: Uint8Array): decode_result; -/** - * Encode some decoded data - */ -declare function encode(data: decoded_data): Uint8Array; diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/rlp.js b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/rlp.js deleted file mode 100644 index 0aa5213..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/rlp.js +++ /dev/null @@ -1,382 +0,0 @@ -/** - * Ethereum Recursive-Length Prefix Encoding implementation - * - * Two reference implementations: - * - * 1. Ethereum Python implementation - * 2. My Erlang implementation (agrees with Ethereum Python in randomized - * tests) - * - * This work can be found in ../test/testgen/ - * - * FIXME: need to have Safe assertions for "i am decoding a list", "i am - * decoding a binary", "I am decoding something with no remainder", etc - * - * @module - */ -export { decode, encode }; -/** - * Decode an RLP-encoded bytestring into a `decode_result` (decoded data + - * whatever wasn't consumed) - */ -function decode(bytes) { - // check the first byte - let first_byte = bytes[0]; - let rest = bytes.slice(1); - // if the first byte is between 0 and 127, that is the data - if (first_byte <= 127) { - return dr(new Uint8Array([first_byte]), rest); - } - // if the first byte is between 128 and 183 = 128 + 55, it is a bytestring - // and the length is Byte - 128 - else if (first_byte <= 183) { - let payload_byte_length = first_byte - 128; - let payload = rest.slice(0, payload_byte_length); - let rest2 = rest.slice(payload_byte_length); - return dr(payload, rest2); - } - // if the first byte is between 184 = 183 + 1 and 191 = 183 + 8, it is a - // bytestring. the byte length of bytestring is FirstByte - 183. Then pull - // out the actual data - else if (first_byte <= 191) { - let byte_length_of_byte_length = first_byte - 183; - let bytes_of_byte_length = rest.slice(0, byte_length_of_byte_length); - let byte_length = bytes_to_number(bytes_of_byte_length); - let bytes = rest.slice(byte_length_of_byte_length, byte_length + byte_length_of_byte_length); - let rest2 = rest.slice(byte_length + byte_length_of_byte_length); - return dr(bytes, rest2); - } - // If the first byte is between 192 and 247 = 192 + 55, it is a list. The - // byte length of the list-payload is FirstByte - 192. Then the list - // payload, which needs to be decoded on its own. - else if (first_byte <= 247) { - let byte_length_of_list = first_byte - 192; - let list_payload = rest.slice(0, byte_length_of_list); - let list = decode_list(list_payload); - let rest2 = rest.slice(byte_length_of_list); - return dr(list, rest2); - } - // If the first byte is between 248 = 247 + 1 and 255 = 247 + 8, it is a - // list. The byte length of the byte length of the list-payload is - // FirstByte - 247. Then the byte length of the list. Then the list - // payload, which needs to be decoded on its own. - else { - let byte_length_of_byte_length = first_byte - 247; - let bytes_of_byte_length = rest.slice(0, byte_length_of_byte_length); - let byte_length = bytes_to_number(bytes_of_byte_length); - let list_bytes = rest.slice(byte_length_of_byte_length, byte_length + byte_length_of_byte_length); - let list = decode_list(list_bytes); - let rest2 = rest.slice(byte_length + byte_length_of_byte_length); - return dr(list, rest2); - } -} -/** - * Decode a list payload (non-prefixed) into an `Array`. - * - * Repeatedly decodes an element off the list until remainder is empty. - * - * @internal - */ -function decode_list(bytes) { - let arr = []; - while (bytes.length > 0) { - // grab an item off the bytes - let { decoded_data, remainder } = decode(bytes); - // push it - arr.push(decoded_data); - // update bytes - bytes = remainder; - } - return arr; -} -/** - * Convert bytestring to number - * - * @internal - */ -function bytes_to_number(bytes) { - let n = 0; - for (let b of bytes) { - n <<= 8; - n += b; - } - return n; -} -/** - * Make a `decode_result` containing the two arguments - * - * @internal - */ -function dr(x, y) { - return { decoded_data: x, - remainder: y }; -} -//============================================================================= -//============================================================================= -// ENCODING -//============================================================================= -//============================================================================= -/** - * Encode some decoded data - */ -function encode(data) { - // is it an array or data - if (is_binary(data)) { - return encode_binary(data); - } - else if (is_list(data)) { - return encode_list(data); - } - else { - throw new Error('encode told to encode something that is not an array or a binary: ' + data); - } -} -/** - * Encode a binary into RLP - * - * @internal - */ -function encode_binary(bytes) { - let len = bytes.length; - // single byte case when the byte is between 0..127 - // result is the bytestring containing the byte itself - if ((len === 1) && - (bytes[0] <= 127)) { - return bytes; - } - // if the bytestring is 0..55 bytes long, the first byte in the result is - // 128 + Length, the rest of the result bytestring is the input string - else if (len <= 55) { - // construct the result - // <<128 + Len, Bytes/binary>> - let result = new Uint8Array(len + 1); - // first byte is 128 + length - result[0] = 128 + len; - // copy input bytes into result - for (let input_idx0 = 0; input_idx0 < len; input_idx0++) { - let result_idx0 = input_idx0 + 1; - result[result_idx0] = bytes[input_idx0]; - } - return result; - } - // if the bytestring is more than 55 bytes long, the first byte is 183 + - // ByteLengthOfByteLength, followed by the byte length, followed by the - // bytes - else { - let len_bytes = encode_unsigned(len); - let len_bytes_length = len_bytes.length; - // total array is - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - let result = new Uint8Array(1 + len_bytes_length + len); - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - // - // ^ YOU ARE HERE - result[0] = 183 + len_bytes_length; - // copy len_bytes into result - for (let len_bytes_idx0 = 0; len_bytes_idx0 < len_bytes_length; len_bytes_idx0++) { - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - // - // ^ YOU ARE HERE - let result_idx0 = len_bytes_idx0 + 1; - result[result_idx0] = len_bytes[len_bytes_idx0]; - } - // copy original byte array into result - for (let input_idx0 = 0; input_idx0 < len; input_idx0++) { - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - // - // ^ YOU ARE HERE - let result_idx0 = input_idx0 + (1 + len_bytes_length); - result[result_idx0] = bytes[input_idx0]; - } - // finally, return the result - return result; - } -} -/** - * Encode a list - * - * @internal - */ -function encode_list(list) { - // first encode every element in the list, then branch - let payloads = list.map(encode); - let payload = uint8arr_concat(payloads); - let payload_size = payload.length; - // if the payload size is in 0..55, then the first byte is 192 + payload - // size, followed by the payload - if (payload_size <= 55) { - // result: <<(192 + Payload_Size), Payload/binary >>; - // 1 byte payload_size bytes - let result = new Uint8Array(1 + payload_size); - // result: <<(192 + Payload_Size), Payload/binary >>; - // 1 byte payload_size bytes - // - // ^ YOU ARE HERE - result[0] = 192 + payload_size; - // copy the rest of the payload into result - for (let payload_idx0 = 0; payload_idx0 < payload_size; payload_idx0++) { - // result: <<(192 + Payload_Size), Payload/binary >>; - // 1 byte payload_size bytes - // - // ^ YOU ARE HERE - let result_idx0 = payload_idx0 + 1; - result[result_idx0] = payload[payload_idx0]; - } - return result; - } - // if the payload size is greater than 55, the first byte is 247 + - // size_of_payload_size, followed by the payload size, followed by the - // payload - else { - // compute the payload size size - let payload_size_bytes = encode_unsigned(payload_size); - let payload_size_size = payload_size_bytes.length; - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - let result = new Uint8Array(1 + payload_size_size + payload_size); - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - // - // ^ YOU ARE HERE - // first byte is 247 + payload_size_size - result[0] = 247 + payload_size_size; - // copy the payload_size_bytes into result - for (let psb_idx0 = 0; psb_idx0 < payload_size_size; psb_idx0++) { - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - // - // ^ YOU ARE HERE - // offset is 1 byte for this - let result_idx0 = psb_idx0 + 1; - result[result_idx0] = payload_size_bytes[psb_idx0]; - } - // copy the payload into result - for (let pb_idx0 = 0; pb_idx0 < payload_size; pb_idx0++) { - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - // - // ^ YOU ARE HERE - // offset is 1 + payload_size_size bytes for this - let result_idx0 = pb_idx0 + (1 + payload_size_size); - result[result_idx0] = payload[pb_idx0]; - } - // finally, return result - return result; - } -} -/** - * Encode a number as a bytestring - * - * Not for general use, this assumes the input number is greater than 55 - * - * @internal - */ -function encode_unsigned(n) { - // can assume that n initially is greater than 55 - // have to encode it in reverse order - let arr = []; - // repeated division by 256 with remainder - // - // example: suppose bign was 1234 and we were dividing by 10 - // - // iteration 0: - // bign = 1234 - // arr = [] - // --- - // bign / 10 = 123 - // bign % 10 = 4 - // --- - // bign = 123 - // arr = [4] - // - // iteration 1: - // bign = 123 - // arr = [4] - // --- - // bign / 10 = 12 - // bign % 10 = 3 - // --- - // bign = 12 - // arr = [4, 3] - // - // iteration 2: - // bign = 12 - // arr = [4, 3] - // --- - // bign / 10 = 1 - // bign % 10 = 2 - // --- - // bign = 1 - // arr = [4, 3, 2] - // - // iteration 3: - // bign = 1 - // arr = [4, 3, 2] - // --- - // bign / 10 = 0 - // bign % 10 = 1 - // --- - // bign = 0 - // arr = [4, 3, 2, 1] - // - // iteration 4: - // bign = 0 - // arr = [4, 3, 2, 1] - // --- - // DONE - while (n > 0) { - arr.push(n % 256); - n >>= 8; - } - // reverse and make into Uint8Array - arr.reverse(); - return new Uint8Array(arr); -} -/** - * concatenate an array of `Uint8Array`s into a single Uint8Array - * - * @internal - */ -function uint8arr_concat(arrs) { - // total length - let total_len = arrs.reduce(// fold - function (acc_len, this_uint8array) { - return acc_len + this_uint8array.length; - }, - // initial accumulator - 0); - // start up result - let result = new Uint8Array(total_len); - let result_idx0 = 0; - // concatenate - for (let this_uint8arr of arrs) { - // bytewise copy of this uint8array - for (let this_uint8arr_idx0 = 0; this_uint8arr_idx0 < this_uint8arr.length; this_uint8arr_idx0++) { - // copy byte and increment result idx0 - result[result_idx0] = this_uint8arr[this_uint8arr_idx0]; - result_idx0++; - } - } - return result; -} -/** - * returns true if input is `instanceof Uint8Array` - * - * @internal - */ -function is_binary(x) { - return (x instanceof Uint8Array); -} -/** - * returns true if input is `instanceof Array` - * - * @internal - */ -function is_list(x) { - return (x instanceof Array); -} -//# sourceMappingURL=rlp.js.map \ No newline at end of file diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/rlp.js.map b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/rlp.js.map deleted file mode 100644 index 4bc573f..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/rlp.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp.js","sourceRoot":"","sources":["../src/rlp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAGH,MAAM,EACN,MAAM,EACT,CAAA;AA4BD;;;GAGG;AACH,SACA,MAAM,CACD,KAAiB;IAGlB,uBAAuB;IACvB,IAAI,UAAU,GAAgB,KAAK,CAAC,CAAC,CAAC,CAAC;IACvC,IAAI,IAAI,GAAsB,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7C,2DAA2D;IAC3D,IACC,UAAU,IAAI,GAAG,EAAE;QAChB,OAAO,EAAE,CAAC,IAAI,UAAU,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;KACjD;IACD,0EAA0E;IAC1E,+BAA+B;SAC1B,IACJ,UAAU,IAAI,GAAG,EAAE;QAChB,IAAI,mBAAmB,GAAgB,UAAU,GAAG,GAAG,CAAC;QACxD,IAAI,OAAO,GAA4B,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC;QAC1E,IAAI,KAAK,GAA8B,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACvE,OAAO,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;KAC7B;IACD,wEAAwE;IACxE,0EAA0E;IAC1E,sBAAsB;SACjB,IACJ,UAAU,IAAI,GAAG,EAAE;QAChB,IAAI,0BAA0B,GAAgB,UAAU,GAAG,GAAG,CAAC;QAC/D,IAAI,oBAAoB,GAAsB,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,0BAA0B,CAAC,CAAC;QACxF,IAAI,WAAW,GAA+B,eAAe,CAAC,oBAAoB,CAAC,CAAC;QACpF,IAAI,KAAK,GAAqC,IAAI,CAAC,KAA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nC,KAAK,IAAI,kBAAkB,GAAG,CAAC,EACtB,kBAAkB,GAAG,aAAa,CAAC,MAAM,EACzC,kBAAkB,EAAE,EAC7B;YACI,sCAAsC;YACtC,MAAM,CAAC,WAAW,CAAC,GAAG,aAAa,CAAC,kBAAkB,CAAC,CAAC;YACxD,WAAW,EAAE,CAAC;SACjB;KACJ;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,SACA,SAAS,CACJ,CAAM;IAGP,OAAO,CAAC,CAAC,YAAY,UAAU,CAAC,CAAC;AACrC,CAAC;AAID;;;;GAIG;AACH,SACA,OAAO,CACF,CAAM;IAGP,OAAO,CAAC,CAAC,YAAY,KAAK,CAAC,CAAC;AAChC,CAAC"} \ No newline at end of file diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/safe.d.ts b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/safe.d.ts deleted file mode 100644 index d03574e..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/safe.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -/** - * "Safe" error handling - * - * The idea here is that there are situations where it is known - * - * ```typescript - * type Safe - * = Ok - * | Error; - * - * type Ok - * = {ok : true, - * result : ok_t}; - * - * type Error - * = {ok : false, - * error : err_t}; - * ``` - * - * 1. a given function call is likely to fail - * 2. the likely errors can be enumerated - * - * These are called "positive errors". An example would be a page script - * asking a browser wallet extension to sign a transaction. The following - * errors, among others, are likely: - * - * - the user does not have a wallet installed - * - the user has a wallet but does not have the correct signing key - * - the user rejects the transaction - * - the sign request timed out - * - * These errors should not generate exceptions, as these behaviors are to some - * degree "expected". - */ -export { Safe, Ok, Error, ok, error, unsafe }; -/** - * Type that catches positive errors - */ -declare type Safe = Ok | Error; -/** - * Ok type - */ -declare type Ok = { - ok: true; - result: ok_t; -}; -/** - * Error type - */ -declare type Error = { - ok: false; - error: err_t; -}; -/** - * Constructs an `Ok` value from a pure value - */ -declare function ok(x: ok_t): Ok; -/** - * Constructs an `Error` value from a pure value - */ -declare function error(x: err_t): Error; -/** - * Takes a `Safe` value, if `ok`, returns the `ok_t`, or if an error throws the - * `err_t` - */ -declare function unsafe(x: Safe): ok_t; diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/safe.js b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/safe.js deleted file mode 100644 index 925656b..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/safe.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * "Safe" error handling - * - * The idea here is that there are situations where it is known - * - * ```typescript - * type Safe - * = Ok - * | Error; - * - * type Ok - * = {ok : true, - * result : ok_t}; - * - * type Error - * = {ok : false, - * error : err_t}; - * ``` - * - * 1. a given function call is likely to fail - * 2. the likely errors can be enumerated - * - * These are called "positive errors". An example would be a page script - * asking a browser wallet extension to sign a transaction. The following - * errors, among others, are likely: - * - * - the user does not have a wallet installed - * - the user has a wallet but does not have the correct signing key - * - the user rejects the transaction - * - the sign request timed out - * - * These errors should not generate exceptions, as these behaviors are to some - * degree "expected". - */ -export { ok, error, unsafe }; -/** - * Constructs an `Ok` value from a pure value - */ -function ok(x) { - return { ok: true, result: x }; -} -/** - * Constructs an `Error` value from a pure value - */ -function error(x) { - return { ok: false, error: x }; -} -/** - * Takes a `Safe` value, if `ok`, returns the `ok_t`, or if an error throws the - * `err_t` - */ -function unsafe(x) { - if (x.ok) - return x.result; - else - throw x.error; -} -//# sourceMappingURL=safe.js.map \ No newline at end of file diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/safe.js.map b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/safe.js.map deleted file mode 100644 index e5e7521..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/dist/safe.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"safe.js","sourceRoot":"","sources":["../src/safe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAIH,EAAE,EACF,KAAK,EACL,MAAM,EACT,CAAA;AA2BD;;GAEG;AACH,SACA,EAAE,CAEG,CAAQ;IAGT,OAAO,EAAC,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAC,CAAC;AACjC,CAAC;AAID;;GAEG;AACH,SACA,KAAK,CAEA,CAAQ;IAGT,OAAO,EAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAC,CAAC;AACjC,CAAC;AAID;;;GAGG;AACH,SACA,MAAM,CAED,CAAoB;IAGrB,IAAI,CAAC,CAAC,EAAE;QACJ,OAAO,CAAC,CAAC,MAAM,CAAC;;QAEhB,MAAM,CAAC,CAAC,KAAK,CAAC;AACtB,CAAC"} \ No newline at end of file diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/b58.ts b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/b58.ts deleted file mode 100644 index 1fd30b8..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/b58.ts +++ /dev/null @@ -1,418 +0,0 @@ -/** - * Base58 encoding/decoding - */ - -export { - encode, - decode -} - - - -//============================================================================= -// ENCODING -//============================================================================= - -/** - * Encode a Uint8Array into base58 - */ -function -encode - (binary : Uint8Array) - : string -{ - let num_leading_zeros : number = nlz(binary); - let rest : Uint8Array = binary.slice(num_leading_zeros); - let ones : string = encode_zeros(num_leading_zeros); - let rest_b58 : string = encode_rest(rest); - let result : string = ones + rest_b58; - return result; -} - - - -/** - * count the number of leading zeros in a uint8array - * - * @internal - */ -function -nlz - (bytes: Uint8Array) - : number -{ - let n = 0; - for (let this_byte of bytes) - { - if (0 === this_byte) { n++; } - else { break; } - } - return n; -} - - - -/** - * Generate a bunch of '1's for however many leading zeros there are - * - * @internal - */ -function -encode_zeros - (how_many : number) - : string -{ - let ones : string = ''; - for (let i = 1; - i <= how_many; - i++) - { - ones += '1'; - } - - return ones; -} - - - -/** - * Encode a Uint8Array that has no leading zeros - * - * @internal - */ -function -encode_rest - (bytes : Uint8Array) - : string -{ - let bytes_bignum : bigint = bytes_to_bigint(bytes); - let result : string = bignum_to_base58(bytes_bignum); - return result; -} - - - -/** - * Convert a bytestring to a bignum - * - * @internal - */ -function -bytes_to_bigint - (bytes: Uint8Array) - : bigint -{ - let acc_bigint : bigint = 0n; - for(let this_byte of bytes) - { - acc_bigint <<= 8n; - acc_bigint += BigInt(this_byte); - } - return acc_bigint; -} - - - -/** - * Convert a BigInt to Base58 - * - * @internal - */ -function -bignum_to_base58 - (q: bigint) - : string -{ - let s = ''; - while (q !== 0n) - { - let this_n : bigint = q % 58n; - q /= 58n; - - let this_b58_char : string = bigint_to_char(this_n); - s = this_b58_char + s; - } - return s; -} - - - -//============================================================================= -// DECODING -//============================================================================= - -/** - * Decode a Base58 string into a Uint8Array - */ -function -decode - (base58: string) - : Uint8Array -{ - let num_leading_ones : number = nlo(base58); - let rest : string = base58.slice(num_leading_ones); - let zeros : Array = decode_ones(num_leading_ones); - let rest_arr : Array = decode_rest(rest); - let pre_result : Array = zeros.concat(rest_arr); - return new Uint8Array(pre_result); -} - - - -/** - * count the number of leading 1 characters in a uint8array - * - * @internal - */ -function -nlo - (base58: string) - : number -{ - let n = 0; - for (let this_char of base58) - { - if ('1' === this_char) { n++; } - else { break; } - } - return n; -} - - - -/** - * Generate a bunch of '0's for however many leading ones there are - * - * @internal - */ -function -decode_ones - (how_many : number) - : Array -{ - let zeros : Array = []; - for (let i = 1; - i <= how_many; - i++) - { - zeros.push(0); - } - - return zeros; -} - - - -/** - * Decode a string that has no leading 1s - * - * @internal - */ -function -decode_rest - (base58: string) - : Array -{ - let result_bignum : bigint = base58_to_bigint(base58); - let result : Array = bigint_to_base256(result_bignum); - return result; -} - - - -/** - * Convert a base58 string to a bignum - * - * @internal - */ -function -base58_to_bigint - (base58: string) - : bigint -{ - let acc_bigint : bigint = 0n; - for(let this_char of base58) - { - acc_bigint *= 58n; - acc_bigint += char_to_bigint(this_char); - } - return acc_bigint; -} - - -/** - * convert a bignum into a byte array - * - * @end - */ -function -bigint_to_base256 - (q: bigint) - : Array -{ - let arr_reverse = []; - while(q !== 0n) - { - let r: number = Number(q % 256n); - q /= 256n; - arr_reverse.push(r); - } - arr_reverse.reverse(); - return arr_reverse; -} - - -//============================================================================= -// TRANSLATION TABLES -//============================================================================= - - -/** - * Base58 integer -> character conversion table - * - * @internal - */ -function -bigint_to_char - (n: bigint) - : string -{ - switch(n) { - case 0n: return '1'; - case 1n: return '2'; - case 2n: return '3'; - case 3n: return '4'; - case 4n: return '5'; - case 5n: return '6'; - case 6n: return '7'; - case 7n: return '8'; - case 8n: return '9'; - case 9n: return 'A'; - case 10n: return 'B'; - case 11n: return 'C'; - case 12n: return 'D'; - case 13n: return 'E'; - case 14n: return 'F'; - case 15n: return 'G'; - case 16n: return 'H'; - case 17n: return 'J'; - case 18n: return 'K'; - case 19n: return 'L'; - case 20n: return 'M'; - case 21n: return 'N'; - case 22n: return 'P'; - case 23n: return 'Q'; - case 24n: return 'R'; - case 25n: return 'S'; - case 26n: return 'T'; - case 27n: return 'U'; - case 28n: return 'V'; - case 29n: return 'W'; - case 30n: return 'X'; - case 31n: return 'Y'; - case 32n: return 'Z'; - case 33n: return 'a'; - case 34n: return 'b'; - case 35n: return 'c'; - case 36n: return 'd'; - case 37n: return 'e'; - case 38n: return 'f'; - case 39n: return 'g'; - case 40n: return 'h'; - case 41n: return 'i'; - case 42n: return 'j'; - case 43n: return 'k'; - case 44n: return 'm'; - case 45n: return 'n'; - case 46n: return 'o'; - case 47n: return 'p'; - case 48n: return 'q'; - case 49n: return 'r'; - case 50n: return 's'; - case 51n: return 't'; - case 52n: return 'u'; - case 53n: return 'v'; - case 54n: return 'w'; - case 55n: return 'x'; - case 56n: return 'y'; - case 57n: return 'z'; - default: - throw new Error('invalid base58 bigint: ' + n); - } -} - - - -/** - * Base58 character -> integer conversion table - * - * @internal - */ -function -char_to_bigint - (s: string) - : bigint -{ - switch(s) { - case '1': return 0n; - case '2': return 1n; - case '3': return 2n; - case '4': return 3n; - case '5': return 4n; - case '6': return 5n; - case '7': return 6n; - case '8': return 7n; - case '9': return 8n; - case 'A': return 9n; - case 'B': return 10n; - case 'C': return 11n; - case 'D': return 12n; - case 'E': return 13n; - case 'F': return 14n; - case 'G': return 15n; - case 'H': return 16n; - case 'J': return 17n; - case 'K': return 18n; - case 'L': return 19n; - case 'M': return 20n; - case 'N': return 21n; - case 'P': return 22n; - case 'Q': return 23n; - case 'R': return 24n; - case 'S': return 25n; - case 'T': return 26n; - case 'U': return 27n; - case 'V': return 28n; - case 'W': return 29n; - case 'X': return 30n; - case 'Y': return 31n; - case 'Z': return 32n; - case 'a': return 33n; - case 'b': return 34n; - case 'c': return 35n; - case 'd': return 36n; - case 'e': return 37n; - case 'f': return 38n; - case 'g': return 39n; - case 'h': return 40n; - case 'i': return 41n; - case 'j': return 42n; - case 'k': return 43n; - case 'm': return 44n; - case 'n': return 45n; - case 'o': return 46n; - case 'p': return 47n; - case 'q': return 48n; - case 'r': return 49n; - case 's': return 50n; - case 't': return 51n; - case 'u': return 52n; - case 'v': return 53n; - case 'w': return 54n; - case 'x': return 55n; - case 'y': return 56n; - case 'z': return 57n; - default: - throw new Error('invalid base58 char: ' + s); - } -} diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/b64.ts b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/b64.ts deleted file mode 100644 index d82cd73..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/b64.ts +++ /dev/null @@ -1,655 +0,0 @@ -/** - * Base64 Utility Functions in TypeScript - */ - -export { - encode, - decode -} - - - -/** - * Encode an array of bytes as a Uint8Array in base64 notation. - */ -function -encode - (bytes: Uint8Array) - : string -{ - // slice the array - // length of head is a multiple of 3 - // treat the tail as a special case - let {head, tail, tail_len} = slice3k(bytes); - let head_str : string = encode_head(head); - let tail_str : string = encode_tail(tail, tail_len); - return head_str + tail_str; -} - - - -type slice3k - = {head : Uint8Array, - tail : Uint8Array, - tail_len : number}; - -/** - * Take a Uint8Array, take the first 3k (k >= 0) bytes, put them in head, and - * the remaining 0,1, or 2 bytes, put them in tail - * - * @internal - */ -function -slice3k - (bytes: Uint8Array) - : slice3k -{ - let len : number = bytes.length; - // too lazy to look up how to do integer division in js so this will do - let tail_len : number = len % 3; - let head_len : number = len - tail_len; - // for slice: - // first argument is the 0-index of the start - // second - first is the length of the slice - let head : Uint8Array = bytes.slice(0, head_len); - // empty second argument means go to the end - let tail : Uint8Array = bytes.slice(head_len); - return {head : head, - tail : tail, - tail_len : tail_len}; -} - - - -/** - * Encode a Uint8Array whose length is known to be a multiple of 3 - * - * @internal - */ -function -encode_head - (head_bytes: Uint8Array) - : string -{ - // can assume length of bytes is a multiple of 3 - // start index at 0 - // increment by 3 - let head_bytes_len : number = head_bytes.length; - let max_idx0 : number = head_bytes_len - 1; - - let head_str_acc : string = ''; - for(let this_3slice_start_idx0 = 0; - this_3slice_start_idx0 <= max_idx0; - this_3slice_start_idx0 += 3) - { - let this_3slice_bytes : Uint8Array = head_bytes.slice(this_3slice_start_idx0, this_3slice_start_idx0 + 3); - let this_3slice_str : string = encode3(this_3slice_bytes); - head_str_acc += this_3slice_str; - } - - return head_str_acc; -} - - - -/** - * Encode a 3 bytes into base64 notation - * - * @internal - */ -function -encode3 - (bytes: Uint8Array) - : string -{ - let b0 : number = bytes[0]; - let b1 : number = bytes[1]; - let b2 : number = bytes[2]; - - // ABCDEFGH 12345678 abcdefgh - // b0 b1 b2 - // ABCDEF GH1234 5678ab cdefgh - // n0 n1 n2 n3 - let n0 : number = b0 >> 2; - // b0 = ABCDEFGH - // 4 = _____1__ - // b0 % 4 = ______GH - // (b0 % 4) << 4 = __GH____ - // b1 = 12345678 - // b1 >> 4 = ____1234 - // n1 = __GH1234 - let n1 : number = ((b0 % 4) << 4) + (b1 >> 4); - // b1 = 12345678 - // 16 = ___1____ - // b1 % 16 = ____5678 - // (b1 % 16) << 2 = __5678__ - // b2 = abcdefgh - // b2 >> 6 = ______ab - // n2 = __5678ab - let n2 : number = ((b1 % 16) << 2) + (b2 >> 6); - // b2 = abcdefgh - // 64 = _1______ - // n3 = __cdefgh - let n3 : number = b2 % 64; - - // convert to chars - let s0 : string = int2char(n0); - let s1 : string = int2char(n1); - let s2 : string = int2char(n2); - let s3 : string = int2char(n3); - - // retrvn - return s0 + s1 + s2 + s3; -} - - - -/** - * Encode the final 0, 1, or 2 bytes - * - * @internal - */ -function -encode_tail - (tail_bytes : Uint8Array, - tail_len : number) - : string -{ - switch(tail_len) { - case 0: return ''; - case 1: return encode1(tail_bytes); - case 2: return encode2(tail_bytes); - default: - throw new Error('encode_tail with tail_len = ' + tail_len); - } -} - - - -/** - * Encode a single byte - * - * @internal - */ -function -encode1 - (bytes: Uint8Array) - : string -{ - let b0 : number = bytes[0]; - // n0 = __ABCDEF - // b0 = ABCDEFGH - // b0 >> 2 = __ABCDEF - let n0 : number = b0 >> 2; - // n1 = __GH____ - // b0 = ABCDEFGH - // 4 = _____1__ - // b0 % 4 = ______GH - // (b0 % 4) << 4 = __GH____ - let n1 : number = (b0 % 4) << 4; - - return int2char(n0) + int2char(n1) + '=='; -} - - - -/** - * Encode two bytes - * - * @internal - */ -function -encode2 - (bytes: Uint8Array) - : string -{ - let b0 : number = bytes[0]; - let b1 : number = bytes[1]; - - // ABCDEFGH 12345678 - // b0 b1 - // ABCDEF GH1234 5678__ - // n0 n1 n2 - let n0 : number = b0 >> 2; - // b0 = ABCDEFGH - // 4 = _____1__ - // b0 % 4 = ______GH - // (b0 % 4) << 4 = __GH____ - // b1 = 12345678 - // b1 >> 4 = ____1234 - // n1 = __GH1234 - let n1 : number = ((b0 % 4) << 4) + (b1 >> 4); - // b1 = 12345678 - // 16 = ___1____ - // b1 % 16 = ____5678 - // (b1 % 16) << 2 = __5678__ - // n2 = __5678__ - let n2 : number = (b1 % 16) << 2; - - // convert to chars - let s0 : string = int2char(n0); - let s1 : string = int2char(n1); - let s2 : string = int2char(n2); - - // retrvn - return s0 + s1 + s2 + '='; -} - - - -/** - * Decode a base64-encoded string - */ -function -decode - (base64_str : string) - : Uint8Array -{ - // length of the string is guaranteed to be a multiple of 4 - // if the string is empty, return the empty array - let len = base64_str.length; - // this branching contains the implicit assertion that the length is a - // multiple of 4. If this is not true, the bottom branch is triggered. - // general case goes first because speeeeeed - if ( (4 < len) - && (0 === (len % 4))) - { - // split the head and tail - let tail_start_idx0 : number = len - 4; - let head_s : string = base64_str.slice(0, tail_start_idx0); - let tail_s : string = base64_str.slice(tail_start_idx0); - // Using arrays because Uint8Arrays don't have a concat operation - let head_arr : Array = decode_head(head_s); - let tail_arr : Array = decode_tail(tail_s); - // silly to put these in variables but this is exactly the type of - // situation where JS type insanity shows up - // - // see: i forgot - // > [1,2,3] + [4,5,6] - // '1,2,34,5,6' - // - // Originally, I used + like some sort of moron who codes in a sane - // language - // - // seriously what is this language - // - // this is some clown behavior - let total_arr : Array = head_arr.concat(tail_arr); - return new Uint8Array(total_arr); - } - // special case if the length is exactly 4 - else if (4 === len) - { - // it's just a tail - return new Uint8Array(decode_tail(base64_str)); - } - // empty string - else if (0 === len) - { - return new Uint8Array([]); - } - else - { - throw new Error('base64 decode: invalid string length: ' + len); - } -} - - - -/** - * Decode a string known to not have any padding - * - * @internal - */ -function -decode_head - (s: string) - : Array -{ - // go 4 characters at a time - let max_i0 : number = s.length - 1; - let decoded_acc : Array = []; - for(let i0 = 0; - i0 <= max_i0; - i0 += 4) - { - let this_slice_s : string = s.slice(i0, i0 + 4); - let this_slice_arr : Array = decode3(this_slice_s); - // update accumulator - decoded_acc = decoded_acc.concat(this_slice_arr); - } - return decoded_acc; -} - - - -/** - * Decode 4 characters that correspond to either 3 bytes, 2, bytes, or 1 byte - * - * @internal - */ -function -decode_tail - (s: string) - : Array -{ - // all that matters right now is the last 2 chars - // s0, s1, s2, s3 - // 0 based indexing is so annoying - let s2 = s[2]; - let s3 = s[3]; - - // braaaaaaaaaaaaaaaaaench - // two equals signs means 1 byte - if (('=' === s3) && ('=' === s2)) { - return decode1(s); - } - // one equals sign means 2 bytes - else if (('=' === s3)) { - return decode2(s); - } - // 0 equals signs means 3 bytes - else { - return decode3(s); - } -} - - - -/** - * Decode a 4-character long base64 string corresponding to 3 bytes - * - * @internal - */ -function -decode3 - (s: string) - : Array -{ - // pull out strings - let s0 : string = s[0]; - let s1 : string = s[1]; - let s2 : string = s[2]; - let s3 : string = s[3]; - - // convert to numbers - let n0 : number = char2int(s0); - let n1 : number = char2int(s1); - let n2 : number = char2int(s2); - let n3 : number = char2int(s3); - - // abcdef gh1234 5678ab cdefgh - // n0 n1 n2 n3 - // abcdefgh 12345678 abcdefgh - // b0 b1 b2 - - // n0 = __abcdef - // n1 = __gh1234 - // n0 << 2 = abcdef__ - // n1 >> 4 = ______gh - // b0 = abcdefgh - let b0 : number = (n0 << 2) + (n1 >> 4); - // n1 = __gh1234 - // 16 = ___1____ - // n1 % 16 = ____1234 - // (n1 % 16) << 4 = 1234____ - // n2 = __5678ab - // n2 >> 2 = ____5678 - // b1 = 12345678 - let b1 : number = ((n1 % 16) << 4) + (n2 >> 2); - // n2 = __5678ab - // 4 = _____1__ - // n2 % 4 = ______ab - // (n2 % 4) << 6 = ab______ - // n3 = __cdefgh - let b2 : number = ((n2 % 4) << 6) + n3; - - return [b0, b1, b2]; -} - - - -/** - * Decode a 4-character long base64 string corresponding to 2 bytes - * - * @internal - */ -function -decode2 - (s: string) - : Array -{ - // xyz= - // pull out strings - let s0 : string = s[0]; - let s1 : string = s[1]; - let s2 : string = s[2]; - - // convert to numbers - let n0 : number = char2int(s0); - let n1 : number = char2int(s1); - let n2 : number = char2int(s2); - - // abcdef gh1234 5678__ - // n0 n1 n2 - // abcdefgh 12345678 - // b0 b1 - - // n0 = __abcdef - // n1 = __gh1234 - // n0 << 2 = abcdef__ - // n1 >> 4 = ______gh - // b0 = abcdefgh - let b0 : number = (n0 << 2) + (n1 >> 4); - // n1 = __gh1234 - // 16 = ___1____ - // n1 % 16 = ____1234 - // (n1 % 16) << 4 = 1234____ - // n2 = __5678__ - // n2 >> 2 = ____5678 - // b1 = 12345678 - let b1 : number = ((n1 % 16) << 4) + (n2 >> 2); - - return [b0, b1]; -} - - - -/** - * Decode a 4-character long base64 string corresponding to 2 bytes - * - * @internal - */ -function -decode1 - (s: string) - : Array -{ - // xy== - // pull out strings - let s0 : string = s[0]; - let s1 : string = s[1]; - - // convert to numbers - let n0 : number = char2int(s0); - let n1 : number = char2int(s1); - - // abcdef gh____ - // n0 n1 - // abcdefgh - // b0 - - // n0 = __abcdef - // n1 = __gh____ - // n0 << 2 = abcdef__ - // n1 >> 4 = ______gh - // b0 = abcdefgh - let b0 : number = (n0 << 2) + (n1 >> 4); - - return [b0]; -} - - - - -// FIXME: these tables would *probably* be faster if they were made into objects - -/** - * Conversion table for base64 encode - * - * @internal - */ -function -int2char - (n: number) - : string -{ - switch(n) { - case 0: return 'A'; - case 1: return 'B'; - case 2: return 'C'; - case 3: return 'D'; - case 4: return 'E'; - case 5: return 'F'; - case 6: return 'G'; - case 7: return 'H'; - case 8: return 'I'; - case 9: return 'J'; - case 10: return 'K'; - case 11: return 'L'; - case 12: return 'M'; - case 13: return 'N'; - case 14: return 'O'; - case 15: return 'P'; - case 16: return 'Q'; - case 17: return 'R'; - case 18: return 'S'; - case 19: return 'T'; - case 20: return 'U'; - case 21: return 'V'; - case 22: return 'W'; - case 23: return 'X'; - case 24: return 'Y'; - case 25: return 'Z'; - case 26: return 'a'; - case 27: return 'b'; - case 28: return 'c'; - case 29: return 'd'; - case 30: return 'e'; - case 31: return 'f'; - case 32: return 'g'; - case 33: return 'h'; - case 34: return 'i'; - case 35: return 'j'; - case 36: return 'k'; - case 37: return 'l'; - case 38: return 'm'; - case 39: return 'n'; - case 40: return 'o'; - case 41: return 'p'; - case 42: return 'q'; - case 43: return 'r'; - case 44: return 's'; - case 45: return 't'; - case 46: return 'u'; - case 47: return 'v'; - case 48: return 'w'; - case 49: return 'x'; - case 50: return 'y'; - case 51: return 'z'; - case 52: return '0'; - case 53: return '1'; - case 54: return '2'; - case 55: return '3'; - case 56: return '4'; - case 57: return '5'; - case 58: return '6'; - case 59: return '7'; - case 60: return '8'; - case 61: return '9'; - case 62: return '+'; - case 63: return '/'; - default: throw new Error("invalid base64 encode byte: " + n); - } -} - - - -/** - * Conversion table for base64 decode - * - * @internal - */ -function -char2int - (s: string) - : number -{ - switch(s) { - case 'A': return 0; - case 'B': return 1; - case 'C': return 2; - case 'D': return 3; - case 'E': return 4; - case 'F': return 5; - case 'G': return 6; - case 'H': return 7; - case 'I': return 8; - case 'J': return 9; - case 'K': return 10; - case 'L': return 11; - case 'M': return 12; - case 'N': return 13; - case 'O': return 14; - case 'P': return 15; - case 'Q': return 16; - case 'R': return 17; - case 'S': return 18; - case 'T': return 19; - case 'U': return 20; - case 'V': return 21; - case 'W': return 22; - case 'X': return 23; - case 'Y': return 24; - case 'Z': return 25; - case 'a': return 26; - case 'b': return 27; - case 'c': return 28; - case 'd': return 29; - case 'e': return 30; - case 'f': return 31; - case 'g': return 32; - case 'h': return 33; - case 'i': return 34; - case 'j': return 35; - case 'k': return 36; - case 'l': return 37; - case 'm': return 38; - case 'n': return 39; - case 'o': return 40; - case 'p': return 41; - case 'q': return 42; - case 'r': return 43; - case 's': return 44; - case 't': return 45; - case 'u': return 46; - case 'v': return 47; - case 'w': return 48; - case 'x': return 49; - case 'y': return 50; - case 'z': return 51; - case '0': return 52; - case '1': return 53; - case '2': return 54; - case '3': return 55; - case '4': return 56; - case '5': return 57; - case '6': return 58; - case '7': return 59; - case '8': return 60; - case '9': return 61; - case '+': return 62; - case '/': return 63; - default: throw new Error("invalid base64 character: " + s); - } -} diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/bin.ts b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/bin.ts deleted file mode 100644 index 958aa2a..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/bin.ts +++ /dev/null @@ -1,377 +0,0 @@ -/** - * Miscellaneous binary utility functions - * - * @module - */ - -export { - bytes_to_bigint, - bigint_to_bytes, - concat, - strong_rand_bytes -}; - - - -/** - * Concatenate two arrays - */ -function -concat - (arr1 : Uint8Array, - arr2 : Uint8Array) - : Uint8Array -{ - let len1 : number = arr1.length; - let len2 : number = arr2.length; - let arr1_idx0_offset : number = 0; - let arr2_idx0_offset : number = len1; - let result_len : number = len1 + len2; - let result : Uint8Array = new Uint8Array(result_len); - // copy first array into result - for (let arr1_idx0 = 0; - arr1_idx0 < len1; - arr1_idx0++) - { - // no offset here - let result_idx0 : number = arr1_idx0 + arr1_idx0_offset; - result[result_idx0] = arr1[arr1_idx0]; - } - // copy second array into result - for (let arr2_idx0 = 0; - arr2_idx0 < len2; - arr2_idx0++) - { - // offset by the length of the first array - let result_idx0 : number = arr2_idx0 + arr2_idx0_offset; - result[result_idx0] = arr2[arr2_idx0]; - } - return result; -} - - - -/** - * Cryptographically random bytes - */ -function -strong_rand_bytes - (how_many : number) - : Uint8Array -{ - let arr = new Uint8Array(how_many); - (new Crypto()).getRandomValues(arr); - return arr; -} - - - -/** - * Convert a byte array to a bigint - * - * Equivalent to `binary:decode_unsigned/1` from Erlang - */ -function -bytes_to_bigint - (bytes: Uint8Array) - : bigint -{ - let n : bigint = 0n; - for (let b of bytes) { - // move first, then add - // otherwise it ends on a move - // imperative languages are for losers - n <<= 8n; - n += BigInt(b); - } - return n; -} - - - -/** - * Convert a bigint to a byte array - * - * Equivalent to `binary:encode_unsigned/1` from Erlang - * - * Requires input to be positive - */ -function -bigint_to_bytes - (q: bigint) - : Uint8Array -{ - if (q < 0n) { - throw new Error('q < 0n: ' + q); - } - - let arr_reverse = []; - while (q > 0n) { - let r = Number(q % 256n); - q /= 256n; - arr_reverse.push(r); - } - arr_reverse.reverse(); - return new Uint8Array(arr_reverse); -} - - - -/** - * Oh no, bitstrings in a language that only has bytestrings - * - * By convention these are `Uint8Array`s with byte length `ceil(bit_length / - * 8)`, and all trailing bits are zero. - */ -type bits = - {bit_length : number, - bytes : Uint8Array}; - - - -/** - * Get an uninitialized bitstring - * - * @internal - */ -function -bits_null - (bit_length : number) - : bits -{ - let byte_length : number = Math.ceil(bit_length / 8); - let result : Uint8Array = new Uint8Array(byte_length); - return {bit_length : bit_length, - bytes : result}; -} - - - -/** - * Get a bitstring of a given length where every value is 0. - */ -function -bits_zeros - (bit_length : number) - : bits -{ - let byte_length : number = Math.ceil(bit_length / 8); - let result : Uint8Array = new Uint8Array(byte_length); - for (let i0 = 0; - i0 < byte_length; - i0++) - { - result[i0] = 0; - } - return {bit_length : bit_length, - bytes : result}; -} - - - -/** - * Get a bitstring of a given length where every value is 1. - */ -function -bits_ones - (bit_length : number) - : bits -{ - let byte_length : number = Math.ceil(bit_length / 8); - let result : Uint8Array = new Uint8Array(byte_length); - - // fill everything except the last byte with 255s - for (let i0 = 0; - i0 < (byte_length - 1); - i0++) - { - result[i0] = 255; - } - - // alright so the last byte - // ok so the number of leading 0s is - // 8 - (bit_length % 8) - let num_trailing_zero_bits : number = 8 - (bit_length % 8); - // the trailing byte is 255 << that - // e.g. 3 trailing 0s - // 1111_1111 -> 1111_1000 - let last_byte : number = 255 << num_trailing_zero_bits; - let last_byte_idx0 : number = byte_length - 1; - result[last_byte_idx0] = last_byte; - - return {bit_length : bit_length, - bytes : result}; -} - - - -/** - * Get the bit at a given 0-index - */ -function -bits_i0th - (bit_idx0 : number, - bits : bits) - : number -{ - // first task is figuring out what byte we're at - // for instance if we want bit 27 - // 3*8 = 24 =< 27 < 4*8 - // so it's Math.floor(bit_idx0 / 8) - let byte_idx0 : number = Math.floor(bit_idx0 / 8); - // let's fetch the byte and work with that - let the_byte : number = bits.bytes[byte_idx0]; - - // ok so let's go with 27 again - // 27 = 3 mod 8 - // so we bitshift right by (8 - 3) - // and then take the remainder dividing by 2 - // --B-_---- -> ----_---B -> 0000_000B - let bsr : number = 8 - (bit_idx0 % 8); - return (the_byte >> bsr) % 2; -} - - - -/** - * Concatenate two bitstrings - */ -function -bits_concat - (bits1 : bits, - bits2 : bits) - : bits -{ - let result_bit_length : number = bits1.bit_length + bits2.bit_length; - let bytes1 : Uint8Array = bits1.bytes; - let bytes2 : Uint8Array = bits2.bytes; - // using zeros here because of our xor trick in a minute - let result_bits : bits = bits_null(result_bit_length); - let result_bytes : Uint8Array = result_bits.bytes; - - // go along each byte in result, and compute the byte boundary - for (let i = 0; - i < result_bytes.length; - i++) - { - // ABCD_EFGH _ - // 0123_4567 8 - // this is the bit index of the leftmost bit in this byte - let start_bit_bi0 : number = i * 8; - let next_start_bit_bi0 : number = start_bit_bi0 + 8; - // does the bit at the beginning of this byte correspond to the first array? - // strict comparison: - // suppose i = 0, - // suppose bit_length1 is 0 - // then this says no, go to second array - // suppose bl1 = 1, - // this says start at first array - let start_bit_is_of_first_array : boolean = start_bit_bi0 < bits1.bit_length; - // weak comparison: - // suppose bit_length1 = 8 - // ABCD_EFGH _ - // 0123_4567 8 - // ^ - // start_bit_bi0 ^ next_start_bit_bi0 - let stop_bit_is_of_first_array : boolean = next_start_bit_bi0 <= bits1.bit_length; - // is this a bytes1 byte - let is_bytes1_byte : boolean = start_bit_is_of_first_array && stop_bit_is_of_first_array; - let is_boundary_byte : boolean = start_bit_is_of_first_array && !stop_bit_is_of_first_array; - - // need to work out the ping_pong bs up here because js is dumb and I - // can't put lets between elseifs - // alright, now we're in the case of only copying from the second array - // we have two cases: - // ping-pong: - // ABCD_EFGH 1234_5678 - // - ---- --- - // copying these bits - // ping: - // ABCD_EFGH - // - ---- 000 - // - // how to distinguish between these two?? - // - // we're in the ping case when the start_bit_bi0 corresponds to the - // final byte of the second array - // - // ok - // - // we need to compute the bit address in the second array that - // corresponds to the bit address at the beginning of this byte in the - // result array - let bits2_addr_bi0 : number = start_bit_bi0 - bits1.bit_length; - // I think the variable is - // bits_left_to_copy = bits2.bit_length - bit_addr2_bi0 - // no + 1 because the current bit is uncopied, - // so if bit_addr2_bi0 = 7 and bits2.bit_length is 8, it means we - // have the last bit to copy - // cases: - // bits_left_to_copy <= 0 -> - // this would mean we have more bits to copy, but are out of - // source bits. should be impossible if bits_null is correct - // bits_left_to_copy <= 8 -> - // this would mean we are going to fill this last byte in the - // result array with the correct bits from array2, but how we - // do this will depend on how those are arranged in bytes2 - // (whether we grab one or two bytes) - // - // this is the tricky case - // - // I think what matters here is the byte address in the second array - // if we're on the last byte - // 8 < bits_left_to_copy -> - // this means we can safely grab two bytes from bytes2, and do - // our bitshifting to make it correct - // - // FIXME - let bits_left_to_copy : number = bits2.bit_length - bits2_addr_bi0; - // no the variable that matters is which byte we're on in the result - let this_bytes2_addr_i0 : number = Math.floor(bits2_addr_bi0 / 8); - let next_bytes2_addr_i0 : number = this_bytes2_addr_i0 + 1; - let bitshift_amt : number = bits1.bit_length % 8; - - let ping : boolean = next_bytes2_addr_i0 === bytes2.length; - - - // simple case: this is a byte from the first array - // just copy it - if (is_bytes1_byte) - result_bytes[i] = bytes1[i]; - // this is a boundary byte - // further cases: - // second bit length is 0 -> - // ABCD_EF-- - // ^ starting here - // just copy first byte and move along - else if (is_boundary_byte && (bits2.bit_length === 0)) - result_bytes[i] = bytes1[i]; - // boundary byte, and there is at least one byte in the second array - else if (is_boundary_byte) - { - // copy over the first byte - result_bytes[i] = bytes1[i]; - // take the first byte from the second array - let first_byte_of_second_array : number = bytes2[0]; - // bytes1: - // ABCD_EF00 - // 6 - // bytes2: - // 1234_5678 - // 0000_0012 - // and bitshift it right by that amount - let bitshift_amt : number = bits1.bit_length % 8; - result_bytes[i] ^= first_byte_of_second_array >> bitshift_amt; - } - // last byte of second array - else if (ping) - result_bytes[i] = (bytes2[this_bytes2_addr_i0] << bitshift_amt); - // ping-pong: not last byte of second array - else - result_bytes[i] = (bytes2[this_bytes2_addr_i0] << bitshift_amt) ^ (bytes2[next_bytes2_addr_i0] << bitshift_amt); - } - - return {bit_length : result_bit_length, - bytes : result_bytes}; - -} diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/faert.ts b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/faert.ts deleted file mode 100644 index 16c4c43..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/faert.ts +++ /dev/null @@ -1,399 +0,0 @@ -/** - * FÆRT: Fast Æternity Recovery Text - * - * Reference: https://gitlab.com/zxq9/passgas/-/blob/83607fedb08be5dfd03210e331f9c76125bb3467/fullofbeans - * - * @module - */ - -export { - encode, - decode, - byte_of_word, - check_word, - check_byte, - words -} - -import * as safe from './safe.js'; - - - -/** - * Encode a bytestring into FÆRT - */ -function -encode - (bytes : Uint8Array) - : string -{ - // initial accumulator - let words_acc : Array = []; - - // go along each byte and look up the word - // add it to the accumulator - for (let this_byte of bytes) - { - let this_word = words[this_byte]; - words_acc.push(this_word); - } - - // prepend check word to phrase - // yes craig it would be faster to do the check byte inline - // the usage case here is 64 byte strings - // double pass is not a big deal - return check_word(bytes) + ' ' + words_acc.join(' '); -} - - - -/** - * Decode a FAERT string into bytes - */ -function -decode - (faert : string) - : safe.Safe -{ - let all_words : Array = faert.split(' '); - let input_check_word : string = all_words[0]; - let input_words : Array = all_words.slice(1) - - // accumulator - let computed_bytes : Array = []; - - // loop over words and figure out accumulator - for (let this_input_word of input_words) - { - let maybe_this_byte : safe.Safe = byte_of_word(this_input_word); - // if the word is an allowable word, add it to the accumulator - if (maybe_this_byte.ok) - { - let this_byte : number = maybe_this_byte.result; - computed_bytes.push(this_byte); - } - // error case, propagate the error up the call chain - else - return maybe_this_byte; - } - - // at this point, we can assume we correctly decoded all words - // compute the check byte - let computed_bytes_u8s : Uint8Array = new Uint8Array(computed_bytes); - let computed_check_word : string = check_word(computed_bytes_u8s); - - // check if it is correct - // if so, return the computed bytes - if (computed_check_word === input_check_word) - return safe.ok(computed_bytes_u8s); - // otherwise, return an error - else - return safe.error('checksum failure! computed check word: ' + computed_check_word + '; input check word: ' + input_check_word); -} - - - -/** - * given a word, find its index - */ -function -byte_of_word - (word: string) - : safe.Safe -{ - for (let i=0; i<=255; i++) - { - if (word === words[i]) - return safe.ok(i); - } - return safe.error('invalid word: ' + word); -} - - - -/** - * compute the check word of an array - */ -function -check_word - (bytes: Uint8Array) - : string -{ - return words[check_byte(bytes)]; -} - - -/** - * given an array, compute the xor of all the bytes in the array - */ -function -check_byte - (bytes: Uint8Array) - : number -{ - let check_byte = 0; - for (let this_byte of bytes) - check_byte ^= this_byte; - return check_byte; -} - - - -let words = [ - "able", - "abuse", - "acquire", - "adjust", - "agent", - "air", - "alert", - "alpha", - "anger", - "answer", - "any", - "argue", - "around", - "assume", - "asthma", - "aunt", - "awkward", - "balcony", - "barrel", - "because", - "behave", - "bicycle", - "bike", - "blind", - "blouse", - "bonus", - "bottom", - "breeze", - "brother", - "bubble", - "burger", - "butter", - "can", - "cannon", - "cargo", - "catalog", - "caught", - "century", - "chaos", - "chicken", - "churn", - "cinnamon", - "clever", - "clock", - "clown", - "collect", - "conduct", - "convince", - "correct", - "cradle", - "crane", - "crime", - "cross", - "crystal", - "curve", - "daughter", - "debris", - "decrease", - "deny", - "deputy", - "despair", - "diesel", - "dinner", - "distance", - "document", - "donate", - "drama", - "drink", - "dutch", - "earth", - "educate", - "elbow", - "employ", - "endless", - "enlist", - "enter", - "equal", - "eternal", - "example", - "exhibit", - "exotic", - "faculty", - "famous", - "fault", - "feature", - "fiber", - "filter", - "firm", - "flame", - "flush", - "follow", - "forward", - "frame", - "fringe", - "future", - "game", - "gate", - "gift", - "glare", - "glow", - "goat", - "grab", - "grief", - "guilt", - "hand", - "hawk", - "health", - "hen", - "hire", - "honey", - "hover", - "hurry", - "hybrid", - "impose", - "inch", - "inherit", - "injury", - "install", - "iron", - "jazz", - "joke", - "just", - "kit", - "kitchen", - "language", - "laundry", - "leader", - "lend", - "leopard", - "license", - "live", - "lobster", - "lounge", - "magnet", - "mail", - "mansion", - "mass", - "math", - "media", - "message", - "metal", - "misery", - "mix", - "more", - "mountain", - "museum", - "mutual", - "narrow", - "nerve", - "next", - "note", - "obey", - "obtain", - "offer", - "once", - "orange", - "ostrich", - "over", - "owner", - "palace", - "patch", - "pave", - "pen", - "phrase", - "piece", - "pizza", - "plunge", - "polar", - "pool", - "power", - "pretty", - "private", - "protect", - "pulp", - "purity", - "quit", - "quote", - "raise", - "razor", - "recall", - "region", - "relief", - "rent", - "rescue", - "review", - "ride", - "risk", - "roof", - "rough", - "saddle", - "salmon", - "sand", - "scene", - "scrub", - "season", - "seek", - "series", - "shed", - "shoe", - "sick", - "silent", - "situate", - "skill", - "slide", - "slush", - "snack", - "solar", - "soul", - "special", - "sphere", - "spot", - "spy", - "stairs", - "stereo", - "strategy", - "stuff", - "success", - "sunny", - "surge", - "swear", - "symptom", - "tail", - "ten", - "tent", - "theme", - "thumb", - "tiny", - "toe", - "tooth", - "topic", - "trade", - "trash", - "trophy", - "truly", - "tumble", - "typical", - "uncle", - "unfair", - "until", - "upper", - "useless", - "van", - "venue", - "video", - "visa", - "vocal", - "walk", - "waste", - "wedding", - "weekend", - "wide", - "winner", - "wise", - "wood", - "wrist", - "zero" -] diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/rlp.ts b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/rlp.ts deleted file mode 100644 index 8c48b75..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/rlp.ts +++ /dev/null @@ -1,521 +0,0 @@ -/** - * Ethereum Recursive-Length Prefix Encoding implementation - * - * Two reference implementations: - * - * 1. Ethereum Python implementation - * 2. My Erlang implementation (agrees with Ethereum Python in randomized - * tests) - * - * This work can be found in ../test/testgen/ - * - * FIXME: need to have Safe assertions for "i am decoding a list", "i am - * decoding a binary", "I am decoding something with no remainder", etc - * - * @module - */ - -export { - decoded_data, - decode_result, - decode, - encode -} - - -//============================================================================= -//============================================================================= -// DECODING -//============================================================================= -//============================================================================= - - -/** - * Data that RLP can encode. Also the result of decoding. - */ -type decoded_data - = Uint8Array - | Array; - - - -/** - * Decoding can have a remainder - */ -type decode_result - = {decoded_data : decoded_data, - remainder : Uint8Array}; - - - -/** - * Decode an RLP-encoded bytestring into a `decode_result` (decoded data + - * whatever wasn't consumed) - */ -function -decode - (bytes: Uint8Array) - : decode_result -{ - // check the first byte - let first_byte: number = bytes[0]; - let rest : Uint8Array = bytes.slice(1); - // if the first byte is between 0 and 127, that is the data - if - (first_byte <= 127) { - return dr(new Uint8Array([first_byte]), rest); - } - // if the first byte is between 128 and 183 = 128 + 55, it is a bytestring - // and the length is Byte - 128 - else if - (first_byte <= 183) { - let payload_byte_length : number = first_byte - 128; - let payload : Uint8Array = rest.slice(0, payload_byte_length); - let rest2 : Uint8Array = rest.slice(payload_byte_length); - return dr(payload, rest2); - } - // if the first byte is between 184 = 183 + 1 and 191 = 183 + 8, it is a - // bytestring. the byte length of bytestring is FirstByte - 183. Then pull - // out the actual data - else if - (first_byte <= 191) { - let byte_length_of_byte_length : number = first_byte - 183; - let bytes_of_byte_length : Uint8Array = rest.slice(0, byte_length_of_byte_length); - let byte_length : number = bytes_to_number(bytes_of_byte_length); - let bytes : Uint8Array = rest.slice(byte_length_of_byte_length, - byte_length + byte_length_of_byte_length); - let rest2 : Uint8Array = rest.slice(byte_length + byte_length_of_byte_length); - return dr(bytes, rest2); - } - // If the first byte is between 192 and 247 = 192 + 55, it is a list. The - // byte length of the list-payload is FirstByte - 192. Then the list - // payload, which needs to be decoded on its own. - else if - (first_byte <= 247) { - let byte_length_of_list : number = first_byte - 192; - let list_payload : Uint8Array = rest.slice(0, byte_length_of_list); - let list : Array = decode_list(list_payload); - let rest2 : Uint8Array = rest.slice(byte_length_of_list); - return dr(list, rest2); - } - // If the first byte is between 248 = 247 + 1 and 255 = 247 + 8, it is a - // list. The byte length of the byte length of the list-payload is - // FirstByte - 247. Then the byte length of the list. Then the list - // payload, which needs to be decoded on its own. - else { - let byte_length_of_byte_length : number = first_byte - 247; - let bytes_of_byte_length : Uint8Array = rest.slice(0, byte_length_of_byte_length); - let byte_length : number = bytes_to_number(bytes_of_byte_length); - let list_bytes : Uint8Array = rest.slice(byte_length_of_byte_length, - byte_length + byte_length_of_byte_length); - let list : Array = decode_list(list_bytes); - let rest2 : Uint8Array = rest.slice(byte_length + byte_length_of_byte_length); - return dr(list, rest2); - } -} - - - -/** - * Decode a list payload (non-prefixed) into an `Array`. - * - * Repeatedly decodes an element off the list until remainder is empty. - * - * @internal - */ -function -decode_list - (bytes: Uint8Array) - : Array -{ - let arr : Array = []; - while (bytes.length > 0) { - // grab an item off the bytes - let {decoded_data, remainder} = decode(bytes); - // push it - arr.push(decoded_data); - // update bytes - bytes = remainder; - } - return arr; -} - - - -/** - * Convert bytestring to number - * - * @internal - */ -function -bytes_to_number - (bytes: Uint8Array) - : number -{ - let n : number = 0; - for (let b of bytes) - { - n <<= 8; - n += b; - } - return n; -} - - - -/** - * Make a `decode_result` containing the two arguments - * - * @internal - */ -function -dr - (x : decoded_data, - y : Uint8Array) - : decode_result -{ - return {decoded_data : x, - remainder : y}; -} - - - -//============================================================================= -//============================================================================= -// ENCODING -//============================================================================= -//============================================================================= - -/** - * Encode some decoded data - */ -function -encode - (data: decoded_data) - : Uint8Array -{ - // is it an array or data - if - (is_binary(data)) { - return encode_binary(data as Uint8Array); - } - else if - (is_list(data)) { - return encode_list(data as Array); - } - else { - throw new Error('encode told to encode something that is not an array or a binary: ' + data); - } -} - - - -/** - * Encode a binary into RLP - * - * @internal - */ -function -encode_binary - (bytes: Uint8Array) - : Uint8Array -{ - let len: number = bytes.length; - // single byte case when the byte is between 0..127 - // result is the bytestring containing the byte itself - if - ((len === 1) && - (bytes[0] <= 127)){ - return bytes; - } - // if the bytestring is 0..55 bytes long, the first byte in the result is - // 128 + Length, the rest of the result bytestring is the input string - else if - (len <= 55) { - // construct the result - // <<128 + Len, Bytes/binary>> - let result : Uint8Array = new Uint8Array(len + 1); - // first byte is 128 + length - result[0] = 128 + len; - // copy input bytes into result - for (let input_idx0 = 0; - input_idx0 < len; - input_idx0++) - { - let result_idx0 : number = input_idx0 + 1; - result[result_idx0] = bytes[input_idx0]; - } - return result; - } - // if the bytestring is more than 55 bytes long, the first byte is 183 + - // ByteLengthOfByteLength, followed by the byte length, followed by the - // bytes - else { - let len_bytes : Uint8Array = encode_unsigned(len); - let len_bytes_length : number = len_bytes.length; - // total array is - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - let result : Uint8Array = new Uint8Array(1 + len_bytes_length + len); - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - // - // ^ YOU ARE HERE - result[0] = 183 + len_bytes_length; - // copy len_bytes into result - for (let len_bytes_idx0 = 0; - len_bytes_idx0 < len_bytes_length; - len_bytes_idx0++) - { - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - // - // ^ YOU ARE HERE - let result_idx0: number = len_bytes_idx0 + 1; - result[result_idx0] = len_bytes[len_bytes_idx0]; - } - // copy original byte array into result - for (let input_idx0 = 0; - input_idx0 < len; - input_idx0++) - { - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - // - // ^ YOU ARE HERE - let result_idx0: number = input_idx0 + (1 + len_bytes_length); - result[result_idx0] = bytes[input_idx0]; - } - // finally, return the result - return result; - } -} - - - -/** - * Encode a list - * - * @internal - */ -function -encode_list - (list: Array) - : Uint8Array -{ - // first encode every element in the list, then branch - let payloads : Array = list.map(encode); - let payload : Uint8Array = uint8arr_concat(payloads); - let payload_size : number = payload.length; - // if the payload size is in 0..55, then the first byte is 192 + payload - // size, followed by the payload - if - (payload_size <= 55) { - // result: <<(192 + Payload_Size), Payload/binary >>; - // 1 byte payload_size bytes - let result : Uint8Array = new Uint8Array(1 + payload_size); - // result: <<(192 + Payload_Size), Payload/binary >>; - // 1 byte payload_size bytes - // - // ^ YOU ARE HERE - result[0] = 192 + payload_size; - // copy the rest of the payload into result - for (let payload_idx0 = 0; - payload_idx0 < payload_size; - payload_idx0++) - { - // result: <<(192 + Payload_Size), Payload/binary >>; - // 1 byte payload_size bytes - // - // ^ YOU ARE HERE - let result_idx0: number = payload_idx0 + 1; - result[result_idx0] = payload[payload_idx0]; - } - return result; - } - // if the payload size is greater than 55, the first byte is 247 + - // size_of_payload_size, followed by the payload size, followed by the - // payload - else { - // compute the payload size size - let payload_size_bytes : Uint8Array = encode_unsigned(payload_size); - let payload_size_size : number = payload_size_bytes.length; - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - let result: Uint8Array = new Uint8Array(1 + payload_size_size + payload_size); - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - // - // ^ YOU ARE HERE - // first byte is 247 + payload_size_size - result[0] = 247 + payload_size_size; - // copy the payload_size_bytes into result - for (let psb_idx0 = 0; - psb_idx0 < payload_size_size; - psb_idx0++) - { - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - // - // ^ YOU ARE HERE - // offset is 1 byte for this - let result_idx0 : number = psb_idx0 + 1; - result[result_idx0] = payload_size_bytes[psb_idx0]; - } - // copy the payload into result - for (let pb_idx0 = 0; - pb_idx0 < payload_size; - pb_idx0++) - { - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - // - // ^ YOU ARE HERE - // offset is 1 + payload_size_size bytes for this - let result_idx0 : number = pb_idx0 + (1 + payload_size_size); - result[result_idx0] = payload[pb_idx0]; - } - // finally, return result - return result; - } -} - - - -/** - * Encode a number as a bytestring - * - * Not for general use, this assumes the input number is greater than 55 - * - * @internal - */ -function -encode_unsigned - (n: number) - : Uint8Array -{ - // can assume that n initially is greater than 55 - // have to encode it in reverse order - let arr : Array = []; - // repeated division by 256 with remainder - // - // example: suppose bign was 1234 and we were dividing by 10 - // - // iteration 0: - // bign = 1234 - // arr = [] - // --- - // bign / 10 = 123 - // bign % 10 = 4 - // --- - // bign = 123 - // arr = [4] - // - // iteration 1: - // bign = 123 - // arr = [4] - // --- - // bign / 10 = 12 - // bign % 10 = 3 - // --- - // bign = 12 - // arr = [4, 3] - // - // iteration 2: - // bign = 12 - // arr = [4, 3] - // --- - // bign / 10 = 1 - // bign % 10 = 2 - // --- - // bign = 1 - // arr = [4, 3, 2] - // - // iteration 3: - // bign = 1 - // arr = [4, 3, 2] - // --- - // bign / 10 = 0 - // bign % 10 = 1 - // --- - // bign = 0 - // arr = [4, 3, 2, 1] - // - // iteration 4: - // bign = 0 - // arr = [4, 3, 2, 1] - // --- - // DONE - while (n > 0) { - arr.push(n % 256); - n >>= 8; - } - // reverse and make into Uint8Array - arr.reverse(); - return new Uint8Array(arr); -} - - - -/** - * concatenate an array of `Uint8Array`s into a single Uint8Array - * - * @internal - */ -function -uint8arr_concat - (arrs: Array) - : Uint8Array -{ - // total length - let total_len = arrs.reduce(// fold - function (acc_len: number, this_uint8array: Uint8Array): number { - return acc_len + this_uint8array.length; - }, - // initial accumulator - 0); - // start up result - let result : Uint8Array = new Uint8Array(total_len); - let result_idx0 : number = 0; - // concatenate - for (let this_uint8arr of arrs) { - // bytewise copy of this uint8array - for (let this_uint8arr_idx0 = 0; - this_uint8arr_idx0 < this_uint8arr.length; - this_uint8arr_idx0++) - { - // copy byte and increment result idx0 - result[result_idx0] = this_uint8arr[this_uint8arr_idx0]; - result_idx0++; - } - } - return result; -} - -/** - * returns true if input is `instanceof Uint8Array` - * - * @internal - */ -function -is_binary - (x: any) - : boolean -{ - return (x instanceof Uint8Array); -} - - - -/** - * returns true if input is `instanceof Array` - * - * @internal - */ -function -is_list - (x: any) - : boolean -{ - return (x instanceof Array); -} diff --git a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/safe.ts b/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/safe.ts deleted file mode 100644 index b3e4c0c..0000000 --- a/libs/vdk_tests_cases/dist/jex_include/local-vdk-0.1.0/src/safe.ts +++ /dev/null @@ -1,112 +0,0 @@ -/** - * "Safe" error handling - * - * The idea here is that there are situations where it is known - * - * ```typescript - * type Safe - * = Ok - * | Error; - * - * type Ok - * = {ok : true, - * result : ok_t}; - * - * type Error - * = {ok : false, - * error : err_t}; - * ``` - * - * 1. a given function call is likely to fail - * 2. the likely errors can be enumerated - * - * These are called "positive errors". An example would be a page script - * asking a browser wallet extension to sign a transaction. The following - * errors, among others, are likely: - * - * - the user does not have a wallet installed - * - the user has a wallet but does not have the correct signing key - * - the user rejects the transaction - * - the sign request timed out - * - * These errors should not generate exceptions, as these behaviors are to some - * degree "expected". - */ - -export { - Safe, - Ok, - Error, - ok, - error, - unsafe -} - - -/** - * Type that catches positive errors - */ -type Safe - = Ok - | Error; - - -/** - * Ok type - */ -type Ok - = {ok : true, - result : ok_t}; - - -/** - * Error type - */ -type Error - = {ok : false, - error : err_t}; - - -/** - * Constructs an `Ok` value from a pure value - */ -function -ok - - (x : ok_t) - : Ok -{ - return {ok: true, result: x}; -} - - - -/** - * Constructs an `Error` value from a pure value - */ -function -error - - (x: err_t) - : Error -{ - return {ok: false, error: x}; -} - - - -/** - * Takes a `Safe` value, if `ok`, returns the `ok_t`, or if an error throws the - * `err_t` - */ -function -unsafe - - (x: Safe) - : ok_t -{ - if (x.ok) - return x.result; - else - throw x.error; -} diff --git a/libs/vdk_tests_cases/dist/rlpcases.d.ts b/libs/vdk_tests_cases/dist/rlpcases.d.ts index 2782d44..8609ca4 100644 --- a/libs/vdk_tests_cases/dist/rlpcases.d.ts +++ b/libs/vdk_tests_cases/dist/rlpcases.d.ts @@ -1,4 +1,4 @@ -import * as rlp from './jex_include/local-vdk-0.1.0/dist/rlp.js'; +import * as rlp from './jex_include/local-vdk_rlp-0.1.0/dist/vdk_rlp.js'; declare type rlpcases = { decoded: rlp.decoded_data; encoded: Uint8Array; diff --git a/libs/vdk_tests_cases/jex.eterms b/libs/vdk_tests_cases/jex.eterms index ce3f754..43c5dca 100644 --- a/libs/vdk_tests_cases/jex.eterms +++ b/libs/vdk_tests_cases/jex.eterms @@ -1,5 +1,5 @@ {type, library}. {realm, local}. -{name, vdk_cases}. +{name, vdk_tests_cases}. {version, "0.1.0"}. -{deps, ["local-vdk-0.1.0"]}. +{deps, ["local-vdk_rlp-0.1.0"]}. diff --git a/libs/vdk_tests_cases/jex_mindist/dist/cases.d.ts b/libs/vdk_tests_cases/jex_mindist/dist/cases.d.ts index 3f9a08c..9567eb8 100644 --- a/libs/vdk_tests_cases/jex_mindist/dist/cases.d.ts +++ b/libs/vdk_tests_cases/jex_mindist/dist/cases.d.ts @@ -1,5 +1,5 @@ export declare const rlp: { - decoded: import("./jex_include/local-vdk-0.1.0/dist/rlp.js").decoded_data; + decoded: import("./jex_include/local-vdk_rlp-0.1.0/dist/vdk_rlp.js").decoded_data; encoded: Uint8Array; }[]; export declare const base58: { diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b58.d.ts b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b58.d.ts deleted file mode 100644 index ce46968..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b58.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Base58 encoding/decoding - */ -export { encode, decode }; -/** - * Encode a Uint8Array into base58 - */ -declare function encode(binary: Uint8Array): string; -/** - * Decode a Base58 string into a Uint8Array - */ -declare function decode(base58: string): Uint8Array; diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b58.js b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b58.js deleted file mode 100644 index e8a7064..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b58.js +++ /dev/null @@ -1,308 +0,0 @@ -/** - * Base58 encoding/decoding - */ -export { encode, decode }; -//============================================================================= -// ENCODING -//============================================================================= -/** - * Encode a Uint8Array into base58 - */ -function encode(binary) { - let num_leading_zeros = nlz(binary); - let rest = binary.slice(num_leading_zeros); - let ones = encode_zeros(num_leading_zeros); - let rest_b58 = encode_rest(rest); - let result = ones + rest_b58; - return result; -} -/** - * count the number of leading zeros in a uint8array - * - * @internal - */ -function nlz(bytes) { - let n = 0; - for (let this_byte of bytes) { - if (0 === this_byte) { - n++; - } - else { - break; - } - } - return n; -} -/** - * Generate a bunch of '1's for however many leading zeros there are - * - * @internal - */ -function encode_zeros(how_many) { - let ones = ''; - for (let i = 1; i <= how_many; i++) { - ones += '1'; - } - return ones; -} -/** - * Encode a Uint8Array that has no leading zeros - * - * @internal - */ -function encode_rest(bytes) { - let bytes_bignum = bytes_to_bigint(bytes); - let result = bignum_to_base58(bytes_bignum); - return result; -} -/** - * Convert a bytestring to a bignum - * - * @internal - */ -function bytes_to_bigint(bytes) { - let acc_bigint = 0n; - for (let this_byte of bytes) { - acc_bigint <<= 8n; - acc_bigint += BigInt(this_byte); - } - return acc_bigint; -} -/** - * Convert a BigInt to Base58 - * - * @internal - */ -function bignum_to_base58(q) { - let s = ''; - while (q !== 0n) { - let this_n = q % 58n; - q /= 58n; - let this_b58_char = bigint_to_char(this_n); - s = this_b58_char + s; - } - return s; -} -//============================================================================= -// DECODING -//============================================================================= -/** - * Decode a Base58 string into a Uint8Array - */ -function decode(base58) { - let num_leading_ones = nlo(base58); - let rest = base58.slice(num_leading_ones); - let zeros = decode_ones(num_leading_ones); - let rest_arr = decode_rest(rest); - let pre_result = zeros.concat(rest_arr); - return new Uint8Array(pre_result); -} -/** - * count the number of leading 1 characters in a uint8array - * - * @internal - */ -function nlo(base58) { - let n = 0; - for (let this_char of base58) { - if ('1' === this_char) { - n++; - } - else { - break; - } - } - return n; -} -/** - * Generate a bunch of '0's for however many leading ones there are - * - * @internal - */ -function decode_ones(how_many) { - let zeros = []; - for (let i = 1; i <= how_many; i++) { - zeros.push(0); - } - return zeros; -} -/** - * Decode a string that has no leading 1s - * - * @internal - */ -function decode_rest(base58) { - let result_bignum = base58_to_bigint(base58); - let result = bigint_to_base256(result_bignum); - return result; -} -/** - * Convert a base58 string to a bignum - * - * @internal - */ -function base58_to_bigint(base58) { - let acc_bigint = 0n; - for (let this_char of base58) { - acc_bigint *= 58n; - acc_bigint += char_to_bigint(this_char); - } - return acc_bigint; -} -/** - * convert a bignum into a byte array - * - * @end - */ -function bigint_to_base256(q) { - let arr_reverse = []; - while (q !== 0n) { - let r = Number(q % 256n); - q /= 256n; - arr_reverse.push(r); - } - arr_reverse.reverse(); - return arr_reverse; -} -//============================================================================= -// TRANSLATION TABLES -//============================================================================= -/** - * Base58 integer -> character conversion table - * - * @internal - */ -function bigint_to_char(n) { - switch (n) { - case 0n: return '1'; - case 1n: return '2'; - case 2n: return '3'; - case 3n: return '4'; - case 4n: return '5'; - case 5n: return '6'; - case 6n: return '7'; - case 7n: return '8'; - case 8n: return '9'; - case 9n: return 'A'; - case 10n: return 'B'; - case 11n: return 'C'; - case 12n: return 'D'; - case 13n: return 'E'; - case 14n: return 'F'; - case 15n: return 'G'; - case 16n: return 'H'; - case 17n: return 'J'; - case 18n: return 'K'; - case 19n: return 'L'; - case 20n: return 'M'; - case 21n: return 'N'; - case 22n: return 'P'; - case 23n: return 'Q'; - case 24n: return 'R'; - case 25n: return 'S'; - case 26n: return 'T'; - case 27n: return 'U'; - case 28n: return 'V'; - case 29n: return 'W'; - case 30n: return 'X'; - case 31n: return 'Y'; - case 32n: return 'Z'; - case 33n: return 'a'; - case 34n: return 'b'; - case 35n: return 'c'; - case 36n: return 'd'; - case 37n: return 'e'; - case 38n: return 'f'; - case 39n: return 'g'; - case 40n: return 'h'; - case 41n: return 'i'; - case 42n: return 'j'; - case 43n: return 'k'; - case 44n: return 'm'; - case 45n: return 'n'; - case 46n: return 'o'; - case 47n: return 'p'; - case 48n: return 'q'; - case 49n: return 'r'; - case 50n: return 's'; - case 51n: return 't'; - case 52n: return 'u'; - case 53n: return 'v'; - case 54n: return 'w'; - case 55n: return 'x'; - case 56n: return 'y'; - case 57n: return 'z'; - default: - throw new Error('invalid base58 bigint: ' + n); - } -} -/** - * Base58 character -> integer conversion table - * - * @internal - */ -function char_to_bigint(s) { - switch (s) { - case '1': return 0n; - case '2': return 1n; - case '3': return 2n; - case '4': return 3n; - case '5': return 4n; - case '6': return 5n; - case '7': return 6n; - case '8': return 7n; - case '9': return 8n; - case 'A': return 9n; - case 'B': return 10n; - case 'C': return 11n; - case 'D': return 12n; - case 'E': return 13n; - case 'F': return 14n; - case 'G': return 15n; - case 'H': return 16n; - case 'J': return 17n; - case 'K': return 18n; - case 'L': return 19n; - case 'M': return 20n; - case 'N': return 21n; - case 'P': return 22n; - case 'Q': return 23n; - case 'R': return 24n; - case 'S': return 25n; - case 'T': return 26n; - case 'U': return 27n; - case 'V': return 28n; - case 'W': return 29n; - case 'X': return 30n; - case 'Y': return 31n; - case 'Z': return 32n; - case 'a': return 33n; - case 'b': return 34n; - case 'c': return 35n; - case 'd': return 36n; - case 'e': return 37n; - case 'f': return 38n; - case 'g': return 39n; - case 'h': return 40n; - case 'i': return 41n; - case 'j': return 42n; - case 'k': return 43n; - case 'm': return 44n; - case 'n': return 45n; - case 'o': return 46n; - case 'p': return 47n; - case 'q': return 48n; - case 'r': return 49n; - case 's': return 50n; - case 't': return 51n; - case 'u': return 52n; - case 'v': return 53n; - case 'w': return 54n; - case 'x': return 55n; - case 'y': return 56n; - case 'z': return 57n; - default: - throw new Error('invalid base58 char: ' + s); - } -} -//# sourceMappingURL=b58.js.map \ No newline at end of file diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b58.js.map b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b58.js.map deleted file mode 100644 index c93be14..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b58.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"b58.js","sourceRoot":"","sources":["../src/b58.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACH,MAAM,EACN,MAAM,EACT,CAAA;AAID,+EAA+E;AAC/E,WAAW;AACX,+EAA+E;AAE/E;;GAEG;AACH,SACA,MAAM,CACD,MAAmB;IAGpB,IAAI,iBAAiB,GAAgB,GAAG,CAAC,MAAM,CAAC,CAAC;IACjD,IAAI,IAAI,GAA6B,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrE,IAAI,IAAI,GAA6B,YAAY,CAAC,iBAAiB,CAAC,CAAC;IACrE,IAAI,QAAQ,GAAyB,WAAW,CAAC,IAAI,CAAC,CAAC;IACvD,IAAI,MAAM,GAA2B,IAAI,GAAG,QAAQ,CAAC;IACrD,OAAO,MAAM,CAAC;AAClB,CAAC;AAID;;;;GAIG;AACH,SACA,GAAG,CACE,KAAiB;IAGlB,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,KAAK,IAAI,SAAS,IAAI,KAAK,EAC3B;QACI,IAAI,CAAC,KAAK,SAAS,EAAE;YAAE,CAAC,EAAE,CAAC;SAAI;aACV;YAAE,MAAM;SAAE;KAClC;IACD,OAAO,CAAC,CAAC;AACb,CAAC;AAID;;;;GAIG;AACH,SACA,YAAY,CACP,QAAiB;IAGlB,IAAI,IAAI,GAAY,EAAE,CAAC;IACvB,KAAK,IAAI,CAAC,GAAI,CAAC,EACN,CAAC,IAAI,QAAQ,EACb,CAAC,EAAE,EACZ;QACI,IAAI,IAAI,GAAG,CAAC;KACf;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAID;;;;GAIG;AACH,SACA,WAAW,CACN,KAAkB;IAGnB,IAAI,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CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB,KAAK,GAAG,CAAC,CAAC,OAAO,GAAG,CAAC;QACrB;YACI,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,CAAC,CAAC,CAAC;KACpD;AACL,CAAC"} \ No newline at end of file diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b64.d.ts b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b64.d.ts deleted file mode 100644 index 6a91552..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b64.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Base64 Utility Functions in TypeScript - */ -export { encode, decode }; -/** - * Encode an array of bytes as a Uint8Array in base64 notation. - */ -declare function encode(bytes: Uint8Array): string; -/** - * Decode a base64-encoded string - */ -declare function decode(base64_str: string): Uint8Array; diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b64.js b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b64.js deleted file mode 100644 index a7f7fc5..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b64.js +++ /dev/null @@ -1,507 +0,0 @@ -/** - * Base64 Utility Functions in TypeScript - */ -export { encode, decode }; -/** - * Encode an array of bytes as a Uint8Array in base64 notation. - */ -function encode(bytes) { - // slice the array - // length of head is a multiple of 3 - // treat the tail as a special case - let { head, tail, tail_len } = slice3k(bytes); - let head_str = encode_head(head); - let tail_str = encode_tail(tail, tail_len); - return head_str + tail_str; -} -/** - * Take a Uint8Array, take the first 3k (k >= 0) bytes, put them in head, and - * the remaining 0,1, or 2 bytes, put them in tail - * - * @internal - */ -function slice3k(bytes) { - let len = bytes.length; - // too lazy to look up how to do integer division in js so this will do - let tail_len = len % 3; - let head_len = len - tail_len; - // for slice: - // first argument is the 0-index of the start - // second - first is the length of the slice - let head = bytes.slice(0, head_len); - // empty second argument means go to the end - let tail = bytes.slice(head_len); - return { head: head, - tail: tail, - tail_len: tail_len }; -} -/** - * Encode a Uint8Array whose length is known to be a multiple of 3 - * - * @internal - */ -function encode_head(head_bytes) { - // can assume length of bytes is a multiple of 3 - // start index at 0 - // increment by 3 - let head_bytes_len = head_bytes.length; - let max_idx0 = head_bytes_len - 1; - let head_str_acc = ''; - for (let this_3slice_start_idx0 = 0; this_3slice_start_idx0 <= max_idx0; this_3slice_start_idx0 += 3) { - let this_3slice_bytes = head_bytes.slice(this_3slice_start_idx0, this_3slice_start_idx0 + 3); - let this_3slice_str = encode3(this_3slice_bytes); - head_str_acc += this_3slice_str; - } - return head_str_acc; -} -/** - * Encode a 3 bytes into base64 notation - * - * @internal - */ -function encode3(bytes) { - let b0 = bytes[0]; - let b1 = bytes[1]; - let b2 = bytes[2]; - // ABCDEFGH 12345678 abcdefgh - // b0 b1 b2 - // ABCDEF GH1234 5678ab cdefgh - // n0 n1 n2 n3 - let n0 = b0 >> 2; - // b0 = ABCDEFGH - // 4 = _____1__ - // b0 % 4 = ______GH - // (b0 % 4) << 4 = __GH____ - // b1 = 12345678 - // b1 >> 4 = ____1234 - // n1 = __GH1234 - let n1 = ((b0 % 4) << 4) + (b1 >> 4); - // b1 = 12345678 - // 16 = ___1____ - // b1 % 16 = ____5678 - // (b1 % 16) << 2 = __5678__ - // b2 = abcdefgh - // b2 >> 6 = ______ab - // n2 = __5678ab - let n2 = ((b1 % 16) << 2) + (b2 >> 6); - // b2 = abcdefgh - // 64 = _1______ - // n3 = __cdefgh - let n3 = b2 % 64; - // convert to chars - let s0 = int2char(n0); - let s1 = int2char(n1); - let s2 = int2char(n2); - let s3 = int2char(n3); - // retrvn - return s0 + s1 + s2 + s3; -} -/** - * Encode the final 0, 1, or 2 bytes - * - * @internal - */ -function encode_tail(tail_bytes, tail_len) { - switch (tail_len) { - case 0: return ''; - case 1: return encode1(tail_bytes); - case 2: return encode2(tail_bytes); - default: - throw new Error('encode_tail with tail_len = ' + tail_len); - } -} -/** - * Encode a single byte - * - * @internal - */ -function encode1(bytes) { - let b0 = bytes[0]; - // n0 = __ABCDEF - // b0 = ABCDEFGH - // b0 >> 2 = __ABCDEF - let n0 = b0 >> 2; - // n1 = __GH____ - // b0 = ABCDEFGH - // 4 = _____1__ - // b0 % 4 = ______GH - // (b0 % 4) << 4 = __GH____ - let n1 = (b0 % 4) << 4; - return int2char(n0) + int2char(n1) + '=='; -} -/** - * Encode two bytes - * - * @internal - */ -function encode2(bytes) { - let b0 = bytes[0]; - let b1 = bytes[1]; - // ABCDEFGH 12345678 - // b0 b1 - // ABCDEF GH1234 5678__ - // n0 n1 n2 - let n0 = b0 >> 2; - // b0 = ABCDEFGH - // 4 = _____1__ - // b0 % 4 = ______GH - // (b0 % 4) << 4 = __GH____ - // b1 = 12345678 - // b1 >> 4 = ____1234 - // n1 = __GH1234 - let n1 = ((b0 % 4) << 4) + (b1 >> 4); - // b1 = 12345678 - // 16 = ___1____ - // b1 % 16 = ____5678 - // (b1 % 16) << 2 = __5678__ - // n2 = __5678__ - let n2 = (b1 % 16) << 2; - // convert to chars - let s0 = int2char(n0); - let s1 = int2char(n1); - let s2 = int2char(n2); - // retrvn - return s0 + s1 + s2 + '='; -} -/** - * Decode a base64-encoded string - */ -function decode(base64_str) { - // length of the string is guaranteed to be a multiple of 4 - // if the string is empty, return the empty array - let len = base64_str.length; - // this branching contains the implicit assertion that the length is a - // multiple of 4. If this is not true, the bottom branch is triggered. - // general case goes first because speeeeeed - if ((4 < len) - && (0 === (len % 4))) { - // split the head and tail - let tail_start_idx0 = len - 4; - let head_s = base64_str.slice(0, tail_start_idx0); - let tail_s = base64_str.slice(tail_start_idx0); - // Using arrays because Uint8Arrays don't have a concat operation - let head_arr = decode_head(head_s); - let tail_arr = decode_tail(tail_s); - // silly to put these in variables but this is exactly the type of - // situation where JS type insanity shows up - // - // see: i forgot - // > [1,2,3] + [4,5,6] - // '1,2,34,5,6' - // - // Originally, I used + like some sort of moron who codes in a sane - // language - // - // seriously what is this language - // - // this is some clown behavior - let total_arr = head_arr.concat(tail_arr); - return new Uint8Array(total_arr); - } - // special case if the length is exactly 4 - else if (4 === len) { - // it's just a tail - return new Uint8Array(decode_tail(base64_str)); - } - // empty string - else if (0 === len) { - return new Uint8Array([]); - } - else { - throw new Error('base64 decode: invalid string length: ' + len); - } -} -/** - * Decode a string known to not have any padding - * - * @internal - */ -function decode_head(s) { - // go 4 characters at a time - let max_i0 = s.length - 1; - let decoded_acc = []; - for (let i0 = 0; i0 <= max_i0; i0 += 4) { - let this_slice_s = s.slice(i0, i0 + 4); - let this_slice_arr = decode3(this_slice_s); - // update accumulator - decoded_acc = decoded_acc.concat(this_slice_arr); - } - return decoded_acc; -} -/** - * Decode 4 characters that correspond to either 3 bytes, 2, bytes, or 1 byte - * - * @internal - */ -function decode_tail(s) { - // all that matters right now is the last 2 chars - // s0, s1, s2, s3 - // 0 based indexing is so annoying - let s2 = s[2]; - let s3 = s[3]; - // braaaaaaaaaaaaaaaaaench - // two equals signs means 1 byte - if (('=' === s3) && ('=' === s2)) { - return decode1(s); - } - // one equals sign means 2 bytes - else if (('=' === s3)) { - return decode2(s); - } - // 0 equals signs means 3 bytes - else { - return decode3(s); - } -} -/** - * Decode a 4-character long base64 string corresponding to 3 bytes - * - * @internal - */ -function decode3(s) { - // pull out strings - let s0 = s[0]; - let s1 = s[1]; - let s2 = s[2]; - let s3 = s[3]; - // convert to numbers - let n0 = char2int(s0); - let n1 = char2int(s1); - let n2 = char2int(s2); - let n3 = char2int(s3); - // abcdef gh1234 5678ab cdefgh - // n0 n1 n2 n3 - // abcdefgh 12345678 abcdefgh - // b0 b1 b2 - // n0 = __abcdef - // n1 = __gh1234 - // n0 << 2 = abcdef__ - // n1 >> 4 = ______gh - // b0 = abcdefgh - let b0 = (n0 << 2) + (n1 >> 4); - // n1 = __gh1234 - // 16 = ___1____ - // n1 % 16 = ____1234 - // (n1 % 16) << 4 = 1234____ - // n2 = __5678ab - // n2 >> 2 = ____5678 - // b1 = 12345678 - let b1 = ((n1 % 16) << 4) + (n2 >> 2); - // n2 = __5678ab - // 4 = _____1__ - // n2 % 4 = ______ab - // (n2 % 4) << 6 = ab______ - // n3 = __cdefgh - let b2 = ((n2 % 4) << 6) + n3; - return [b0, b1, b2]; -} -/** - * Decode a 4-character long base64 string corresponding to 2 bytes - * - * @internal - */ -function decode2(s) { - // xyz= - // pull out strings - let s0 = s[0]; - let s1 = s[1]; - let s2 = s[2]; - // convert to numbers - let n0 = char2int(s0); - let n1 = char2int(s1); - let n2 = char2int(s2); - // abcdef gh1234 5678__ - // n0 n1 n2 - // abcdefgh 12345678 - // b0 b1 - // n0 = __abcdef - // n1 = __gh1234 - // n0 << 2 = abcdef__ - // n1 >> 4 = ______gh - // b0 = abcdefgh - let b0 = (n0 << 2) + (n1 >> 4); - // n1 = __gh1234 - // 16 = ___1____ - // n1 % 16 = ____1234 - // (n1 % 16) << 4 = 1234____ - // n2 = __5678__ - // n2 >> 2 = ____5678 - // b1 = 12345678 - let b1 = ((n1 % 16) << 4) + (n2 >> 2); - return [b0, b1]; -} -/** - * Decode a 4-character long base64 string corresponding to 2 bytes - * - * @internal - */ -function decode1(s) { - // xy== - // pull out strings - let s0 = s[0]; - let s1 = s[1]; - // convert to numbers - let n0 = char2int(s0); - let n1 = char2int(s1); - // abcdef gh____ - // n0 n1 - // abcdefgh - // b0 - // n0 = __abcdef - // n1 = __gh____ - // n0 << 2 = abcdef__ - // n1 >> 4 = ______gh - // b0 = abcdefgh - let b0 = (n0 << 2) + (n1 >> 4); - return [b0]; -} -// FIXME: these tables would *probably* be faster if they were made into objects -/** - * Conversion table for base64 encode - * - * @internal - */ -function int2char(n) { - switch (n) { - case 0: return 'A'; - case 1: return 'B'; - case 2: return 'C'; - case 3: return 'D'; - case 4: return 'E'; - case 5: return 'F'; - case 6: return 'G'; - case 7: return 'H'; - case 8: return 'I'; - case 9: return 'J'; - case 10: return 'K'; - case 11: return 'L'; - case 12: return 'M'; - case 13: return 'N'; - case 14: return 'O'; - case 15: return 'P'; - case 16: return 'Q'; - case 17: return 'R'; - case 18: return 'S'; - case 19: return 'T'; - case 20: return 'U'; - case 21: return 'V'; - case 22: return 'W'; - case 23: return 'X'; - case 24: return 'Y'; - case 25: return 'Z'; - case 26: return 'a'; - case 27: return 'b'; - case 28: return 'c'; - case 29: return 'd'; - case 30: return 'e'; - case 31: return 'f'; - case 32: return 'g'; - case 33: return 'h'; - case 34: return 'i'; - case 35: return 'j'; - case 36: return 'k'; - case 37: return 'l'; - case 38: return 'm'; - case 39: return 'n'; - case 40: return 'o'; - case 41: return 'p'; - case 42: return 'q'; - case 43: return 'r'; - case 44: return 's'; - case 45: return 't'; - case 46: return 'u'; - case 47: return 'v'; - case 48: return 'w'; - case 49: return 'x'; - case 50: return 'y'; - case 51: return 'z'; - case 52: return '0'; - case 53: return '1'; - case 54: return '2'; - case 55: return '3'; - case 56: return '4'; - case 57: return '5'; - case 58: return '6'; - case 59: return '7'; - case 60: return '8'; - case 61: return '9'; - case 62: return '+'; - case 63: return '/'; - default: throw new Error("invalid base64 encode byte: " + n); - } -} -/** - * Conversion table for base64 decode - * - * @internal - */ -function char2int(s) { - switch (s) { - case 'A': return 0; - case 'B': return 1; - case 'C': return 2; - case 'D': return 3; - case 'E': return 4; - case 'F': return 5; - case 'G': return 6; - case 'H': return 7; - case 'I': return 8; - case 'J': return 9; - case 'K': return 10; - case 'L': return 11; - case 'M': return 12; - case 'N': return 13; - case 'O': return 14; - case 'P': return 15; - case 'Q': return 16; - case 'R': return 17; - case 'S': return 18; - case 'T': return 19; - case 'U': return 20; - case 'V': return 21; - case 'W': return 22; - case 'X': return 23; - case 'Y': return 24; - case 'Z': return 25; - case 'a': return 26; - case 'b': return 27; - case 'c': return 28; - case 'd': return 29; - case 'e': return 30; - case 'f': return 31; - case 'g': return 32; - case 'h': return 33; - case 'i': return 34; - case 'j': return 35; - case 'k': return 36; - case 'l': return 37; - case 'm': return 38; - case 'n': return 39; - case 'o': return 40; - case 'p': return 41; - case 'q': return 42; - case 'r': return 43; - case 's': return 44; - case 't': return 45; - case 'u': return 46; - case 'v': return 47; - case 'w': return 48; - case 'x': return 49; - case 'y': return 50; - case 'z': return 51; - case '0': return 52; - case '1': return 53; - case '2': return 54; - case '3': return 55; - case '4': return 56; - case '5': return 57; - case '6': return 58; - case '7': return 59; - case '8': return 60; - case '9': return 61; - case '+': return 62; - case '/': return 63; - default: throw new Error("invalid base64 character: " + s); - } -} -//# sourceMappingURL=b64.js.map \ No newline at end of file diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b64.js.map b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b64.js.map deleted file mode 100644 index 7398ad3..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/b64.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"b64.js","sourceRoot":"","sources":["../src/b64.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACH,MAAM,EACN,MAAM,EACT,CAAA;AAID;;GAEG;AACH,SACA,MAAM,CACD,KAAiB;IAGlB,kBAAkB;IAClB,oCAAoC;IACpC,mCAAmC;IACnC,IAAI,EAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5C,IAAI,QAAQ,GAAY,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1C,IAAI,QAAQ,GAAY,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACpD,OAAO,QAAQ,GAAG,QAAQ,CAAC;AAC/B,CAAC;AASD;;;;;GAKG;AACH,SACA,OAAO,CACF,KAAiB;IAGlB,IAAI,GAAG,GAAiB,KAAK,CAAC,MAAM,CAAC;IACrC,uEAAuE;IACvE,IAAI,QAAQ,GAAY,GAAG,GAAG,CAAC,CAAC;IAChC,IAAI,QAAQ,GAAY,GAAG,GAAG,QAAQ,CAAC;IACvC,aAAa;IACb,6CAA6C;IAC7C,4CAA4C;IAC5C,IAAI,IAAI,GAAgB,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IACjD,4CAA4C;IAC5C,IAAI,IAAI,GAAgB,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC9C,OAAO,EAAC,IAAI,EAAO,IAAI;QACf,IAAI,EAAO,IAAI;QACf,QAAQ,EAAG,QAAQ,EAAC,CAAC;AACjC,CAAC;AAID;;;;GAIG;AACH,SACA,WAAW,CACN,UAAsB;IAGvB,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K,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,CAAC,CAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,GAAG,CAAC,CAAC,CAAC;KAC/D;AACL,CAAC"} \ No newline at end of file diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/bin.d.ts b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/bin.d.ts deleted file mode 100644 index 915e4ce..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/bin.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Miscellaneous binary utility functions - * - * @module - */ -export { bytes_to_bigint, bigint_to_bytes, concat, strong_rand_bytes }; -/** - * Concatenate two arrays - */ -declare function concat(arr1: Uint8Array, arr2: Uint8Array): Uint8Array; -/** - * Cryptographically random bytes - */ -declare function strong_rand_bytes(how_many: number): Uint8Array; -/** - * Convert a byte array to a bigint - * - * Equivalent to `binary:decode_unsigned/1` from Erlang - */ -declare function bytes_to_bigint(bytes: Uint8Array): bigint; -/** - * Convert a bigint to a byte array - * - * Equivalent to `binary:encode_unsigned/1` from Erlang - * - * Requires input to be positive - */ -declare function bigint_to_bytes(q: bigint): Uint8Array; diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/bin.js b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/bin.js deleted file mode 100644 index 2841b74..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/bin.js +++ /dev/null @@ -1,266 +0,0 @@ -/** - * Miscellaneous binary utility functions - * - * @module - */ -export { bytes_to_bigint, bigint_to_bytes, concat, strong_rand_bytes }; -/** - * Concatenate two arrays - */ -function concat(arr1, arr2) { - let len1 = arr1.length; - let len2 = arr2.length; - let arr1_idx0_offset = 0; - let arr2_idx0_offset = len1; - let result_len = len1 + len2; - let result = new Uint8Array(result_len); - // copy first array into result - for (let arr1_idx0 = 0; arr1_idx0 < len1; arr1_idx0++) { - // no offset here - let result_idx0 = arr1_idx0 + arr1_idx0_offset; - result[result_idx0] = arr1[arr1_idx0]; - } - // copy second array into result - for (let arr2_idx0 = 0; arr2_idx0 < len2; arr2_idx0++) { - // offset by the length of the first array - let result_idx0 = arr2_idx0 + arr2_idx0_offset; - result[result_idx0] = arr2[arr2_idx0]; - } - return result; -} -/** - * Cryptographically random bytes - */ -function strong_rand_bytes(how_many) { - let arr = new Uint8Array(how_many); - (new Crypto()).getRandomValues(arr); - return arr; -} -/** - * Convert a byte array to a bigint - * - * Equivalent to `binary:decode_unsigned/1` from Erlang - */ -function bytes_to_bigint(bytes) { - let n = 0n; - for (let b of bytes) { - // move first, then add - // otherwise it ends on a move - // imperative languages are for losers - n <<= 8n; - n += BigInt(b); - } - return n; -} -/** - * Convert a bigint to a byte array - * - * Equivalent to `binary:encode_unsigned/1` from Erlang - * - * Requires input to be positive - */ -function bigint_to_bytes(q) { - if (q < 0n) { - throw new Error('q < 0n: ' + q); - } - let arr_reverse = []; - while (q > 0n) { - let r = Number(q % 256n); - q /= 256n; - arr_reverse.push(r); - } - arr_reverse.reverse(); - return new Uint8Array(arr_reverse); -} -/** - * Get an uninitialized bitstring - * - * @internal - */ -function bits_null(bit_length) { - let byte_length = Math.ceil(bit_length / 8); - let result = new Uint8Array(byte_length); - return { bit_length: bit_length, - bytes: result }; -} -/** - * Get a bitstring of a given length where every value is 0. - */ -function bits_zeros(bit_length) { - let byte_length = Math.ceil(bit_length / 8); - let result = new Uint8Array(byte_length); - for (let i0 = 0; i0 < byte_length; i0++) { - result[i0] = 0; - } - return { bit_length: bit_length, - bytes: result }; -} -/** - * Get a bitstring of a given length where every value is 1. - */ -function bits_ones(bit_length) { - let byte_length = Math.ceil(bit_length / 8); - let result = new Uint8Array(byte_length); - // fill everything except the last byte with 255s - for (let i0 = 0; i0 < (byte_length - 1); i0++) { - result[i0] = 255; - } - // alright so the last byte - // ok so the number of leading 0s is - // 8 - (bit_length % 8) - let num_trailing_zero_bits = 8 - (bit_length % 8); - // the trailing byte is 255 << that - // e.g. 3 trailing 0s - // 1111_1111 -> 1111_1000 - let last_byte = 255 << num_trailing_zero_bits; - let last_byte_idx0 = byte_length - 1; - result[last_byte_idx0] = last_byte; - return { bit_length: bit_length, - bytes: result }; -} -/** - * Get the bit at a given 0-index - */ -function bits_i0th(bit_idx0, bits) { - // first task is figuring out what byte we're at - // for instance if we want bit 27 - // 3*8 = 24 =< 27 < 4*8 - // so it's Math.floor(bit_idx0 / 8) - let byte_idx0 = Math.floor(bit_idx0 / 8); - // let's fetch the byte and work with that - let the_byte = bits.bytes[byte_idx0]; - // ok so let's go with 27 again - // 27 = 3 mod 8 - // so we bitshift right by (8 - 3) - // and then take the remainder dividing by 2 - // --B-_---- -> ----_---B -> 0000_000B - let bsr = 8 - (bit_idx0 % 8); - return (the_byte >> bsr) % 2; -} -/** - * Concatenate two bitstrings - */ -function bits_concat(bits1, bits2) { - let result_bit_length = bits1.bit_length + bits2.bit_length; - let bytes1 = bits1.bytes; - let bytes2 = bits2.bytes; - // using zeros here because of our xor trick in a minute - let result_bits = bits_null(result_bit_length); - let result_bytes = result_bits.bytes; - // go along each byte in result, and compute the byte boundary - for (let i = 0; i < result_bytes.length; i++) { - // ABCD_EFGH _ - // 0123_4567 8 - // this is the bit index of the leftmost bit in this byte - let start_bit_bi0 = i * 8; - let next_start_bit_bi0 = start_bit_bi0 + 8; - // does the bit at the beginning of this byte correspond to the first array? - // strict comparison: - // suppose i = 0, - // suppose bit_length1 is 0 - // then this says no, go to second array - // suppose bl1 = 1, - // this says start at first array - let start_bit_is_of_first_array = start_bit_bi0 < bits1.bit_length; - // weak comparison: - // suppose bit_length1 = 8 - // ABCD_EFGH _ - // 0123_4567 8 - // ^ - // start_bit_bi0 ^ next_start_bit_bi0 - let stop_bit_is_of_first_array = next_start_bit_bi0 <= bits1.bit_length; - // is this a bytes1 byte - let is_bytes1_byte = start_bit_is_of_first_array && stop_bit_is_of_first_array; - let is_boundary_byte = start_bit_is_of_first_array && !stop_bit_is_of_first_array; - // need to work out the ping_pong bs up here because js is dumb and I - // can't put lets between elseifs - // alright, now we're in the case of only copying from the second array - // we have two cases: - // ping-pong: - // ABCD_EFGH 1234_5678 - // - ---- --- - // copying these bits - // ping: - // ABCD_EFGH - // - ---- 000 - // - // how to distinguish between these two?? - // - // we're in the ping case when the start_bit_bi0 corresponds to the - // final byte of the second array - // - // ok - // - // we need to compute the bit address in the second array that - // corresponds to the bit address at the beginning of this byte in the - // result array - let bits2_addr_bi0 = start_bit_bi0 - bits1.bit_length; - // I think the variable is - // bits_left_to_copy = bits2.bit_length - bit_addr2_bi0 - // no + 1 because the current bit is uncopied, - // so if bit_addr2_bi0 = 7 and bits2.bit_length is 8, it means we - // have the last bit to copy - // cases: - // bits_left_to_copy <= 0 -> - // this would mean we have more bits to copy, but are out of - // source bits. should be impossible if bits_null is correct - // bits_left_to_copy <= 8 -> - // this would mean we are going to fill this last byte in the - // result array with the correct bits from array2, but how we - // do this will depend on how those are arranged in bytes2 - // (whether we grab one or two bytes) - // - // this is the tricky case - // - // I think what matters here is the byte address in the second array - // if we're on the last byte - // 8 < bits_left_to_copy -> - // this means we can safely grab two bytes from bytes2, and do - // our bitshifting to make it correct - // - // FIXME - let bits_left_to_copy = bits2.bit_length - bits2_addr_bi0; - // no the variable that matters is which byte we're on in the result - let this_bytes2_addr_i0 = Math.floor(bits2_addr_bi0 / 8); - let next_bytes2_addr_i0 = this_bytes2_addr_i0 + 1; - let bitshift_amt = bits1.bit_length % 8; - let ping = next_bytes2_addr_i0 === bytes2.length; - // simple case: this is a byte from the first array - // just copy it - if (is_bytes1_byte) - result_bytes[i] = bytes1[i]; - // this is a boundary byte - // further cases: - // second bit length is 0 -> - // ABCD_EF-- - // ^ starting here - // just copy first byte and move along - else if (is_boundary_byte && (bits2.bit_length === 0)) - result_bytes[i] = bytes1[i]; - // boundary byte, and there is at least one byte in the second array - else if (is_boundary_byte) { - // copy over the first byte - result_bytes[i] = bytes1[i]; - // take the first byte from the second array - let first_byte_of_second_array = bytes2[0]; - // bytes1: - // ABCD_EF00 - // 6 - // bytes2: - // 1234_5678 - // 0000_0012 - // and bitshift it right by that amount - let bitshift_amt = bits1.bit_length % 8; - result_bytes[i] ^= first_byte_of_second_array >> bitshift_amt; - } - // last byte of second array - else if (ping) - result_bytes[i] = (bytes2[this_bytes2_addr_i0] << bitshift_amt); - // ping-pong: not last byte of second array - else - result_bytes[i] = (bytes2[this_bytes2_addr_i0] << bitshift_amt) ^ (bytes2[next_bytes2_addr_i0] << bitshift_amt); - } - return { bit_length: result_bit_length, - bytes: result_bytes }; -} -//# sourceMappingURL=bin.js.map \ No newline at end of file diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/bin.js.map b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/bin.js.map deleted file mode 100644 index a87fc4d..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/bin.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACH,eAAe,EACf,eAAe,EACf,MAAM,EACN,iBAAiB,EACpB,CAAC;AAIF;;GAEG;AACH,SACA,MAAM,CACD,IAAiB,EACjB,IAAiB;IAGlB,IAAI,IAAI,GAA4B,IAAI,CAAC,MAAM,CAAC;IAChD,IAAI,IAAI,GAA4B,IAAI,CAAC,MAAM,CAAC;IAChD,IAAI,gBAAgB,GAAgB,CAAC,CAAC;IACtC,IAAI,gBAAgB,GAAgB,IAAI,CAAC;IACzC,IAAI,UAAU,GAAsB,IAAI,GAAG,IAAI,CAAC;IAChD,IAAI,MAAM,GAA0B,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC;IAC/D,+BAA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,IAAI,0BAA0B,IAAI,YAAY,CAAC;SACjE;QACD,4BAA4B;aACvB,IAAI,IAAI;YACT,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,YAAY,CAAC,CAAC;QACpE,2CAA2C;;YAEvC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,YAAY,CAAC,CAAC;KACvH;IAED,OAAO,EAAC,UAAU,EAAG,iBAAiB;QAC9B,KAAK,EAAQ,YAAY,EAAC,CAAC;AAEvC,CAAC"} \ No newline at end of file diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/faert.d.ts b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/faert.d.ts deleted file mode 100644 index fca75f5..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/faert.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * FÆRT: Fast Æternity Recovery Text - * - * Reference: https://gitlab.com/zxq9/passgas/-/blob/83607fedb08be5dfd03210e331f9c76125bb3467/fullofbeans - * - * @module - */ -export { encode, decode, byte_of_word, check_word, check_byte, words }; -import * as safe from './safe.js'; -/** - * Encode a bytestring into FÆRT - */ -declare function encode(bytes: Uint8Array): string; -/** - * Decode a FAERT string into bytes - */ -declare function decode(faert: string): safe.Safe; -/** - * given a word, find its index - */ -declare function byte_of_word(word: string): safe.Safe; -/** - * compute the check word of an array - */ -declare function check_word(bytes: Uint8Array): string; -/** - * given an array, compute the xor of all the bytes in the array - */ -declare function check_byte(bytes: Uint8Array): number; -declare let words: string[]; diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/faert.js b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/faert.js deleted file mode 100644 index 58a5ba3..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/faert.js +++ /dev/null @@ -1,344 +0,0 @@ -/** - * FÆRT: Fast Æternity Recovery Text - * - * Reference: https://gitlab.com/zxq9/passgas/-/blob/83607fedb08be5dfd03210e331f9c76125bb3467/fullofbeans - * - * @module - */ -export { encode, decode, byte_of_word, check_word, check_byte, words }; -import * as safe from './safe.js'; -/** - * Encode a bytestring into FÆRT - */ -function encode(bytes) { - // initial accumulator - let words_acc = []; - // go along each byte and look up the word - // add it to the accumulator - for (let this_byte of bytes) { - let this_word = words[this_byte]; - words_acc.push(this_word); - } - // prepend check word to phrase - // yes craig it would be faster to do the check byte inline - // the usage case here is 64 byte strings - // double pass is not a big deal - return check_word(bytes) + ' ' + words_acc.join(' '); -} -/** - * Decode a FAERT string into bytes - */ -function decode(faert) { - let all_words = faert.split(' '); - let input_check_word = all_words[0]; - let input_words = all_words.slice(1); - // accumulator - let computed_bytes = []; - // loop over words and figure out accumulator - for (let this_input_word of input_words) { - let maybe_this_byte = byte_of_word(this_input_word); - // if the word is an allowable word, add it to the accumulator - if (maybe_this_byte.ok) { - let this_byte = maybe_this_byte.result; - computed_bytes.push(this_byte); - } - // error case, propagate the error up the call chain - else - return maybe_this_byte; - } - // at this point, we can assume we correctly decoded all words - // compute the check byte - let computed_bytes_u8s = new Uint8Array(computed_bytes); - let computed_check_word = check_word(computed_bytes_u8s); - // check if it is correct - // if so, return the computed bytes - if (computed_check_word === input_check_word) - return safe.ok(computed_bytes_u8s); - // otherwise, return an error - else - return safe.error('checksum failure! computed check word: ' + computed_check_word + '; input check word: ' + input_check_word); -} -/** - * given a word, find its index - */ -function byte_of_word(word) { - for (let i = 0; i <= 255; i++) { - if (word === words[i]) - return safe.ok(i); - } - return safe.error('invalid word: ' + word); -} -/** - * compute the check word of an array - */ -function check_word(bytes) { - return words[check_byte(bytes)]; -} -/** - * given an array, compute the xor of all the bytes in the array - */ -function check_byte(bytes) { - let check_byte = 0; - for (let this_byte of bytes) - check_byte ^= this_byte; - return check_byte; -} -let words = [ - "able", - "abuse", - "acquire", - "adjust", - "agent", - "air", - "alert", - "alpha", - "anger", - "answer", - "any", - "argue", - "around", - "assume", - "asthma", - "aunt", - "awkward", - "balcony", - "barrel", - "because", - "behave", - "bicycle", - "bike", - "blind", - "blouse", - "bonus", - "bottom", - "breeze", - "brother", - "bubble", - "burger", - "butter", - "can", - "cannon", - "cargo", - "catalog", - "caught", - "century", - "chaos", - "chicken", - "churn", - "cinnamon", - "clever", - "clock", - "clown", - "collect", - "conduct", - "convince", - "correct", - "cradle", - "crane", - "crime", - "cross", - "crystal", - "curve", - "daughter", - "debris", - "decrease", - "deny", - "deputy", - "despair", - "diesel", - "dinner", - "distance", - "document", - "donate", - "drama", - "drink", - "dutch", - "earth", - "educate", - "elbow", - "employ", - "endless", - "enlist", - "enter", - "equal", - "eternal", - "example", - "exhibit", - "exotic", - "faculty", - "famous", - "fault", - "feature", - "fiber", - "filter", - "firm", - "flame", - "flush", - "follow", - "forward", - "frame", - "fringe", - "future", - "game", - "gate", - "gift", - "glare", - "glow", - "goat", - "grab", - "grief", - "guilt", - "hand", - "hawk", - "health", - "hen", - "hire", - "honey", - "hover", - "hurry", - "hybrid", - "impose", - "inch", - "inherit", - "injury", - "install", - "iron", - "jazz", - "joke", - "just", - "kit", - "kitchen", - "language", - "laundry", - "leader", - "lend", - "leopard", - "license", - "live", - "lobster", - "lounge", - "magnet", - "mail", - "mansion", - "mass", - "math", - "media", - "message", - "metal", - "misery", - "mix", - "more", - "mountain", - "museum", - "mutual", - "narrow", - "nerve", - "next", - "note", - "obey", - "obtain", - "offer", - "once", - "orange", - "ostrich", - "over", - "owner", - "palace", - "patch", - "pave", - "pen", - "phrase", - "piece", - "pizza", - "plunge", - "polar", - "pool", - "power", - "pretty", - "private", - "protect", - "pulp", - "purity", - "quit", - "quote", - "raise", - "razor", - "recall", - "region", - "relief", - "rent", - "rescue", - "review", - "ride", - "risk", - "roof", - "rough", - "saddle", - "salmon", - "sand", - "scene", - "scrub", - "season", - "seek", - "series", - "shed", - "shoe", - "sick", - "silent", - "situate", - "skill", - "slide", - "slush", - "snack", - "solar", - "soul", - "special", - "sphere", - "spot", - "spy", - "stairs", - "stereo", - "strategy", - "stuff", - "success", - "sunny", - "surge", - "swear", - "symptom", - "tail", - "ten", - "tent", - "theme", - "thumb", - "tiny", - "toe", - "tooth", - "topic", - "trade", - "trash", - "trophy", - "truly", - "tumble", - "typical", - "uncle", - "unfair", - "until", - "upper", - "useless", - "van", - "venue", - "video", - "visa", - "vocal", - "walk", - "waste", - "wedding", - "weekend", - "wide", - "winner", - "wise", - "wood", - "wrist", - "zero" -]; -//# sourceMappingURL=faert.js.map \ No newline at end of file diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/faert.js.map b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/faert.js.map deleted file mode 100644 index c7d5d90..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/faert.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"faert.js","sourceRoot":"","sources":["../src/faert.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACH,MAAM,EACN,MAAM,EACN,YAAY,EACZ,UAAU,EACV,UAAU,EACV,KAAK,EACR,CAAA;AAED,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAIlC;;GAEG;AACH,SACA,MAAM,CACD,KAAkB;IAGnB,sBAAsB;IACtB,IAAI,SAAS,GAAoB,EAAE,CAAC;IAEpC,0CAA0C;IAC1C,4BAA4B;IAC5B,KAAK,IAAI,SAAS,IAAI,KAAK,EAC3B;QACI,IAAI,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;QACjC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;KAC7B;IAED,+BAA+B;I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,SAAS;IACT,MAAM;IACN,QAAQ;IACR,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;IACP,OAAO;IACP,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,MAAM;IACN,MAAM;IACN,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,MAAM;IACN,SAAS;IACT,QAAQ;IACR,MAAM;IACN,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,OAAO;IACP,SAAS;IACT,OAAO;IACP,OAAO;IACP,OAAO;IACP,SAAS;IACT,MAAM;IACN,KAAK;IACL,MAAM;IACN,OAAO;IACP,OAAO;IACP,MAAM;IACN,KAAK;IACL,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,SAAS;IACT,OAAO;IACP,QAAQ;IACR,OAAO;IACP,OAAO;IACP,SAAS;IACT,KAAK;IACL,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,SAAS;IACT,SAAS;IACT,MAAM;IACN,QAAQ;IACR,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;CACT,CAAA"} \ No newline at end of file diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/rlp.d.ts b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/rlp.d.ts deleted file mode 100644 index 2072aec..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/rlp.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Ethereum Recursive-Length Prefix Encoding implementation - * - * Two reference implementations: - * - * 1. Ethereum Python implementation - * 2. My Erlang implementation (agrees with Ethereum Python in randomized - * tests) - * - * This work can be found in ../test/testgen/ - * - * FIXME: need to have Safe assertions for "i am decoding a list", "i am - * decoding a binary", "I am decoding something with no remainder", etc - * - * @module - */ -export { decoded_data, decode_result, decode, encode }; -/** - * Data that RLP can encode. Also the result of decoding. - */ -declare type decoded_data = Uint8Array | Array; -/** - * Decoding can have a remainder - */ -declare type decode_result = { - decoded_data: decoded_data; - remainder: Uint8Array; -}; -/** - * Decode an RLP-encoded bytestring into a `decode_result` (decoded data + - * whatever wasn't consumed) - */ -declare function decode(bytes: Uint8Array): decode_result; -/** - * Encode some decoded data - */ -declare function encode(data: decoded_data): Uint8Array; diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/rlp.js b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/rlp.js deleted file mode 100644 index 0aa5213..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/rlp.js +++ /dev/null @@ -1,382 +0,0 @@ -/** - * Ethereum Recursive-Length Prefix Encoding implementation - * - * Two reference implementations: - * - * 1. Ethereum Python implementation - * 2. My Erlang implementation (agrees with Ethereum Python in randomized - * tests) - * - * This work can be found in ../test/testgen/ - * - * FIXME: need to have Safe assertions for "i am decoding a list", "i am - * decoding a binary", "I am decoding something with no remainder", etc - * - * @module - */ -export { decode, encode }; -/** - * Decode an RLP-encoded bytestring into a `decode_result` (decoded data + - * whatever wasn't consumed) - */ -function decode(bytes) { - // check the first byte - let first_byte = bytes[0]; - let rest = bytes.slice(1); - // if the first byte is between 0 and 127, that is the data - if (first_byte <= 127) { - return dr(new Uint8Array([first_byte]), rest); - } - // if the first byte is between 128 and 183 = 128 + 55, it is a bytestring - // and the length is Byte - 128 - else if (first_byte <= 183) { - let payload_byte_length = first_byte - 128; - let payload = rest.slice(0, payload_byte_length); - let rest2 = rest.slice(payload_byte_length); - return dr(payload, rest2); - } - // if the first byte is between 184 = 183 + 1 and 191 = 183 + 8, it is a - // bytestring. the byte length of bytestring is FirstByte - 183. Then pull - // out the actual data - else if (first_byte <= 191) { - let byte_length_of_byte_length = first_byte - 183; - let bytes_of_byte_length = rest.slice(0, byte_length_of_byte_length); - let byte_length = bytes_to_number(bytes_of_byte_length); - let bytes = rest.slice(byte_length_of_byte_length, byte_length + byte_length_of_byte_length); - let rest2 = rest.slice(byte_length + byte_length_of_byte_length); - return dr(bytes, rest2); - } - // If the first byte is between 192 and 247 = 192 + 55, it is a list. The - // byte length of the list-payload is FirstByte - 192. Then the list - // payload, which needs to be decoded on its own. - else if (first_byte <= 247) { - let byte_length_of_list = first_byte - 192; - let list_payload = rest.slice(0, byte_length_of_list); - let list = decode_list(list_payload); - let rest2 = rest.slice(byte_length_of_list); - return dr(list, rest2); - } - // If the first byte is between 248 = 247 + 1 and 255 = 247 + 8, it is a - // list. The byte length of the byte length of the list-payload is - // FirstByte - 247. Then the byte length of the list. Then the list - // payload, which needs to be decoded on its own. - else { - let byte_length_of_byte_length = first_byte - 247; - let bytes_of_byte_length = rest.slice(0, byte_length_of_byte_length); - let byte_length = bytes_to_number(bytes_of_byte_length); - let list_bytes = rest.slice(byte_length_of_byte_length, byte_length + byte_length_of_byte_length); - let list = decode_list(list_bytes); - let rest2 = rest.slice(byte_length + byte_length_of_byte_length); - return dr(list, rest2); - } -} -/** - * Decode a list payload (non-prefixed) into an `Array`. - * - * Repeatedly decodes an element off the list until remainder is empty. - * - * @internal - */ -function decode_list(bytes) { - let arr = []; - while (bytes.length > 0) { - // grab an item off the bytes - let { decoded_data, remainder } = decode(bytes); - // push it - arr.push(decoded_data); - // update bytes - bytes = remainder; - } - return arr; -} -/** - * Convert bytestring to number - * - * @internal - */ -function bytes_to_number(bytes) { - let n = 0; - for (let b of bytes) { - n <<= 8; - n += b; - } - return n; -} -/** - * Make a `decode_result` containing the two arguments - * - * @internal - */ -function dr(x, y) { - return { decoded_data: x, - remainder: y }; -} -//============================================================================= -//============================================================================= -// ENCODING -//============================================================================= -//============================================================================= -/** - * Encode some decoded data - */ -function encode(data) { - // is it an array or data - if (is_binary(data)) { - return encode_binary(data); - } - else if (is_list(data)) { - return encode_list(data); - } - else { - throw new Error('encode told to encode something that is not an array or a binary: ' + data); - } -} -/** - * Encode a binary into RLP - * - * @internal - */ -function encode_binary(bytes) { - let len = bytes.length; - // single byte case when the byte is between 0..127 - // result is the bytestring containing the byte itself - if ((len === 1) && - (bytes[0] <= 127)) { - return bytes; - } - // if the bytestring is 0..55 bytes long, the first byte in the result is - // 128 + Length, the rest of the result bytestring is the input string - else if (len <= 55) { - // construct the result - // <<128 + Len, Bytes/binary>> - let result = new Uint8Array(len + 1); - // first byte is 128 + length - result[0] = 128 + len; - // copy input bytes into result - for (let input_idx0 = 0; input_idx0 < len; input_idx0++) { - let result_idx0 = input_idx0 + 1; - result[result_idx0] = bytes[input_idx0]; - } - return result; - } - // if the bytestring is more than 55 bytes long, the first byte is 183 + - // ByteLengthOfByteLength, followed by the byte length, followed by the - // bytes - else { - let len_bytes = encode_unsigned(len); - let len_bytes_length = len_bytes.length; - // total array is - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - let result = new Uint8Array(1 + len_bytes_length + len); - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - // - // ^ YOU ARE HERE - result[0] = 183 + len_bytes_length; - // copy len_bytes into result - for (let len_bytes_idx0 = 0; len_bytes_idx0 < len_bytes_length; len_bytes_idx0++) { - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - // - // ^ YOU ARE HERE - let result_idx0 = len_bytes_idx0 + 1; - result[result_idx0] = len_bytes[len_bytes_idx0]; - } - // copy original byte array into result - for (let input_idx0 = 0; input_idx0 < len; input_idx0++) { - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - // - // ^ YOU ARE HERE - let result_idx0 = input_idx0 + (1 + len_bytes_length); - result[result_idx0] = bytes[input_idx0]; - } - // finally, return the result - return result; - } -} -/** - * Encode a list - * - * @internal - */ -function encode_list(list) { - // first encode every element in the list, then branch - let payloads = list.map(encode); - let payload = uint8arr_concat(payloads); - let payload_size = payload.length; - // if the payload size is in 0..55, then the first byte is 192 + payload - // size, followed by the payload - if (payload_size <= 55) { - // result: <<(192 + Payload_Size), Payload/binary >>; - // 1 byte payload_size bytes - let result = new Uint8Array(1 + payload_size); - // result: <<(192 + Payload_Size), Payload/binary >>; - // 1 byte payload_size bytes - // - // ^ YOU ARE HERE - result[0] = 192 + payload_size; - // copy the rest of the payload into result - for (let payload_idx0 = 0; payload_idx0 < payload_size; payload_idx0++) { - // result: <<(192 + Payload_Size), Payload/binary >>; - // 1 byte payload_size bytes - // - // ^ YOU ARE HERE - let result_idx0 = payload_idx0 + 1; - result[result_idx0] = payload[payload_idx0]; - } - return result; - } - // if the payload size is greater than 55, the first byte is 247 + - // size_of_payload_size, followed by the payload size, followed by the - // payload - else { - // compute the payload size size - let payload_size_bytes = encode_unsigned(payload_size); - let payload_size_size = payload_size_bytes.length; - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - let result = new Uint8Array(1 + payload_size_size + payload_size); - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - // - // ^ YOU ARE HERE - // first byte is 247 + payload_size_size - result[0] = 247 + payload_size_size; - // copy the payload_size_bytes into result - for (let psb_idx0 = 0; psb_idx0 < payload_size_size; psb_idx0++) { - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - // - // ^ YOU ARE HERE - // offset is 1 byte for this - let result_idx0 = psb_idx0 + 1; - result[result_idx0] = payload_size_bytes[psb_idx0]; - } - // copy the payload into result - for (let pb_idx0 = 0; pb_idx0 < payload_size; pb_idx0++) { - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - // - // ^ YOU ARE HERE - // offset is 1 + payload_size_size bytes for this - let result_idx0 = pb_idx0 + (1 + payload_size_size); - result[result_idx0] = payload[pb_idx0]; - } - // finally, return result - return result; - } -} -/** - * Encode a number as a bytestring - * - * Not for general use, this assumes the input number is greater than 55 - * - * @internal - */ -function encode_unsigned(n) { - // can assume that n initially is greater than 55 - // have to encode it in reverse order - let arr = []; - // repeated division by 256 with remainder - // - // example: suppose bign was 1234 and we were dividing by 10 - // - // iteration 0: - // bign = 1234 - // arr = [] - // --- - // bign / 10 = 123 - // bign % 10 = 4 - // --- - // bign = 123 - // arr = [4] - // - // iteration 1: - // bign = 123 - // arr = [4] - // --- - // bign / 10 = 12 - // bign % 10 = 3 - // --- - // bign = 12 - // arr = [4, 3] - // - // iteration 2: - // bign = 12 - // arr = [4, 3] - // --- - // bign / 10 = 1 - // bign % 10 = 2 - // --- - // bign = 1 - // arr = [4, 3, 2] - // - // iteration 3: - // bign = 1 - // arr = [4, 3, 2] - // --- - // bign / 10 = 0 - // bign % 10 = 1 - // --- - // bign = 0 - // arr = [4, 3, 2, 1] - // - // iteration 4: - // bign = 0 - // arr = [4, 3, 2, 1] - // --- - // DONE - while (n > 0) { - arr.push(n % 256); - n >>= 8; - } - // reverse and make into Uint8Array - arr.reverse(); - return new Uint8Array(arr); -} -/** - * concatenate an array of `Uint8Array`s into a single Uint8Array - * - * @internal - */ -function uint8arr_concat(arrs) { - // total length - let total_len = arrs.reduce(// fold - function (acc_len, this_uint8array) { - return acc_len + this_uint8array.length; - }, - // initial accumulator - 0); - // start up result - let result = new Uint8Array(total_len); - let result_idx0 = 0; - // concatenate - for (let this_uint8arr of arrs) { - // bytewise copy of this uint8array - for (let this_uint8arr_idx0 = 0; this_uint8arr_idx0 < this_uint8arr.length; this_uint8arr_idx0++) { - // copy byte and increment result idx0 - result[result_idx0] = this_uint8arr[this_uint8arr_idx0]; - result_idx0++; - } - } - return result; -} -/** - * returns true if input is `instanceof Uint8Array` - * - * @internal - */ -function is_binary(x) { - return (x instanceof Uint8Array); -} -/** - * returns true if input is `instanceof Array` - * - * @internal - */ -function is_list(x) { - return (x instanceof Array); -} -//# sourceMappingURL=rlp.js.map \ No newline at end of file diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/rlp.js.map b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/rlp.js.map deleted file mode 100644 index 4bc573f..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/rlp.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp.js","sourceRoot":"","sources":["../src/rlp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAGH,MAAM,EACN,MAAM,EACT,CAAA;AA4BD;;;GAGG;AACH,SACA,MAAM,CACD,KAAiB;IAGlB,uBAAuB;IACvB,IAAI,UAAU,GAAgB,KAAK,CAAC,CAAC,CAAC,CAAC;IACvC,IAAI,IAAI,GAAsB,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7C,2DAA2D;IAC3D,IACC,UAAU,IAAI,GAAG,EAAE;QAChB,OAAO,EAAE,CAAC,IAAI,UAAU,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;KACjD;IACD,0EAA0E;IAC1E,+BAA+B;SAC1B,IACJ,UAAU,IAAI,GAAG,EAAE;QAChB,IAAI,mBAAmB,GAAgB,UAAU,GAAG,GAAG,CAAC;QACxD,IAAI,OAAO,GAA4B,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC;QAC1E,IAAI,KAAK,GAA8B,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACvE,OAAO,EAA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AAI,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO;IACP,UAAU,OAAe,EAAE,eAA2B;QAClD,OAAO,OAAO,GAAG,eAAe,CAAC,MAAM,CAAC;IAC5C,CAAC;IACD,sBAAsB;IACtB,CAAC,CAAC,CAAC;IAC/B,kBAAkB;IAClB,IAAI,MAAM,GAAqB,IAAI,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,IAAI,WAAW,GAAgB,CAAC,CAAC;IACjC,cAAc;IACd,KAAK,IAAI,aAAa,IAAI,IAAI,EAAE;QAC5B,mCAAmC;QACnC,KAAK,IAAI,kBAAkB,GAAG,CAAC,EACtB,kBAAkB,GAAG,aAAa,CAAC,MAAM,EACzC,kBAAkB,EAAE,EAC7B;YACI,sCAAsC;YACtC,MAAM,CAAC,WAAW,CAAC,GAAG,aAAa,CAAC,kBAAkB,CAAC,CAAC;YACxD,WAAW,EAAE,CAAC;SACjB;KACJ;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,SACA,SAAS,CACJ,CAAM;IAGP,OAAO,CAAC,CAAC,YAAY,UAAU,CAAC,CAAC;AACrC,CAAC;AAID;;;;GAIG;AACH,SACA,OAAO,CACF,CAAM;IAGP,OAAO,CAAC,CAAC,YAAY,KAAK,CAAC,CAAC;AAChC,CAAC"} \ No newline at end of file diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/safe.d.ts b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/safe.d.ts deleted file mode 100644 index d03574e..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/safe.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -/** - * "Safe" error handling - * - * The idea here is that there are situations where it is known - * - * ```typescript - * type Safe - * = Ok - * | Error; - * - * type Ok - * = {ok : true, - * result : ok_t}; - * - * type Error - * = {ok : false, - * error : err_t}; - * ``` - * - * 1. a given function call is likely to fail - * 2. the likely errors can be enumerated - * - * These are called "positive errors". An example would be a page script - * asking a browser wallet extension to sign a transaction. The following - * errors, among others, are likely: - * - * - the user does not have a wallet installed - * - the user has a wallet but does not have the correct signing key - * - the user rejects the transaction - * - the sign request timed out - * - * These errors should not generate exceptions, as these behaviors are to some - * degree "expected". - */ -export { Safe, Ok, Error, ok, error, unsafe }; -/** - * Type that catches positive errors - */ -declare type Safe = Ok | Error; -/** - * Ok type - */ -declare type Ok = { - ok: true; - result: ok_t; -}; -/** - * Error type - */ -declare type Error = { - ok: false; - error: err_t; -}; -/** - * Constructs an `Ok` value from a pure value - */ -declare function ok(x: ok_t): Ok; -/** - * Constructs an `Error` value from a pure value - */ -declare function error(x: err_t): Error; -/** - * Takes a `Safe` value, if `ok`, returns the `ok_t`, or if an error throws the - * `err_t` - */ -declare function unsafe(x: Safe): ok_t; diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/safe.js b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/safe.js deleted file mode 100644 index 925656b..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/safe.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * "Safe" error handling - * - * The idea here is that there are situations where it is known - * - * ```typescript - * type Safe - * = Ok - * | Error; - * - * type Ok - * = {ok : true, - * result : ok_t}; - * - * type Error - * = {ok : false, - * error : err_t}; - * ``` - * - * 1. a given function call is likely to fail - * 2. the likely errors can be enumerated - * - * These are called "positive errors". An example would be a page script - * asking a browser wallet extension to sign a transaction. The following - * errors, among others, are likely: - * - * - the user does not have a wallet installed - * - the user has a wallet but does not have the correct signing key - * - the user rejects the transaction - * - the sign request timed out - * - * These errors should not generate exceptions, as these behaviors are to some - * degree "expected". - */ -export { ok, error, unsafe }; -/** - * Constructs an `Ok` value from a pure value - */ -function ok(x) { - return { ok: true, result: x }; -} -/** - * Constructs an `Error` value from a pure value - */ -function error(x) { - return { ok: false, error: x }; -} -/** - * Takes a `Safe` value, if `ok`, returns the `ok_t`, or if an error throws the - * `err_t` - */ -function unsafe(x) { - if (x.ok) - return x.result; - else - throw x.error; -} -//# sourceMappingURL=safe.js.map \ No newline at end of file diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/safe.js.map b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/safe.js.map deleted file mode 100644 index e5e7521..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/dist/safe.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"safe.js","sourceRoot":"","sources":["../src/safe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAIH,EAAE,EACF,KAAK,EACL,MAAM,EACT,CAAA;AA2BD;;GAEG;AACH,SACA,EAAE,CAEG,CAAQ;IAGT,OAAO,EAAC,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAC,CAAC;AACjC,CAAC;AAID;;GAEG;AACH,SACA,KAAK,CAEA,CAAQ;IAGT,OAAO,EAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAC,CAAC;AACjC,CAAC;AAID;;;GAGG;AACH,SACA,MAAM,CAED,CAAoB;IAGrB,IAAI,CAAC,CAAC,EAAE;QACJ,OAAO,CAAC,CAAC,MAAM,CAAC;;QAEhB,MAAM,CAAC,CAAC,KAAK,CAAC;AACtB,CAAC"} \ No newline at end of file diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/b58.ts b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/b58.ts deleted file mode 100644 index 1fd30b8..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/b58.ts +++ /dev/null @@ -1,418 +0,0 @@ -/** - * Base58 encoding/decoding - */ - -export { - encode, - decode -} - - - -//============================================================================= -// ENCODING -//============================================================================= - -/** - * Encode a Uint8Array into base58 - */ -function -encode - (binary : Uint8Array) - : string -{ - let num_leading_zeros : number = nlz(binary); - let rest : Uint8Array = binary.slice(num_leading_zeros); - let ones : string = encode_zeros(num_leading_zeros); - let rest_b58 : string = encode_rest(rest); - let result : string = ones + rest_b58; - return result; -} - - - -/** - * count the number of leading zeros in a uint8array - * - * @internal - */ -function -nlz - (bytes: Uint8Array) - : number -{ - let n = 0; - for (let this_byte of bytes) - { - if (0 === this_byte) { n++; } - else { break; } - } - return n; -} - - - -/** - * Generate a bunch of '1's for however many leading zeros there are - * - * @internal - */ -function -encode_zeros - (how_many : number) - : string -{ - let ones : string = ''; - for (let i = 1; - i <= how_many; - i++) - { - ones += '1'; - } - - return ones; -} - - - -/** - * Encode a Uint8Array that has no leading zeros - * - * @internal - */ -function -encode_rest - (bytes : Uint8Array) - : string -{ - let bytes_bignum : bigint = bytes_to_bigint(bytes); - let result : string = bignum_to_base58(bytes_bignum); - return result; -} - - - -/** - * Convert a bytestring to a bignum - * - * @internal - */ -function -bytes_to_bigint - (bytes: Uint8Array) - : bigint -{ - let acc_bigint : bigint = 0n; - for(let this_byte of bytes) - { - acc_bigint <<= 8n; - acc_bigint += BigInt(this_byte); - } - return acc_bigint; -} - - - -/** - * Convert a BigInt to Base58 - * - * @internal - */ -function -bignum_to_base58 - (q: bigint) - : string -{ - let s = ''; - while (q !== 0n) - { - let this_n : bigint = q % 58n; - q /= 58n; - - let this_b58_char : string = bigint_to_char(this_n); - s = this_b58_char + s; - } - return s; -} - - - -//============================================================================= -// DECODING -//============================================================================= - -/** - * Decode a Base58 string into a Uint8Array - */ -function -decode - (base58: string) - : Uint8Array -{ - let num_leading_ones : number = nlo(base58); - let rest : string = base58.slice(num_leading_ones); - let zeros : Array = decode_ones(num_leading_ones); - let rest_arr : Array = decode_rest(rest); - let pre_result : Array = zeros.concat(rest_arr); - return new Uint8Array(pre_result); -} - - - -/** - * count the number of leading 1 characters in a uint8array - * - * @internal - */ -function -nlo - (base58: string) - : number -{ - let n = 0; - for (let this_char of base58) - { - if ('1' === this_char) { n++; } - else { break; } - } - return n; -} - - - -/** - * Generate a bunch of '0's for however many leading ones there are - * - * @internal - */ -function -decode_ones - (how_many : number) - : Array -{ - let zeros : Array = []; - for (let i = 1; - i <= how_many; - i++) - { - zeros.push(0); - } - - return zeros; -} - - - -/** - * Decode a string that has no leading 1s - * - * @internal - */ -function -decode_rest - (base58: string) - : Array -{ - let result_bignum : bigint = base58_to_bigint(base58); - let result : Array = bigint_to_base256(result_bignum); - return result; -} - - - -/** - * Convert a base58 string to a bignum - * - * @internal - */ -function -base58_to_bigint - (base58: string) - : bigint -{ - let acc_bigint : bigint = 0n; - for(let this_char of base58) - { - acc_bigint *= 58n; - acc_bigint += char_to_bigint(this_char); - } - return acc_bigint; -} - - -/** - * convert a bignum into a byte array - * - * @end - */ -function -bigint_to_base256 - (q: bigint) - : Array -{ - let arr_reverse = []; - while(q !== 0n) - { - let r: number = Number(q % 256n); - q /= 256n; - arr_reverse.push(r); - } - arr_reverse.reverse(); - return arr_reverse; -} - - -//============================================================================= -// TRANSLATION TABLES -//============================================================================= - - -/** - * Base58 integer -> character conversion table - * - * @internal - */ -function -bigint_to_char - (n: bigint) - : string -{ - switch(n) { - case 0n: return '1'; - case 1n: return '2'; - case 2n: return '3'; - case 3n: return '4'; - case 4n: return '5'; - case 5n: return '6'; - case 6n: return '7'; - case 7n: return '8'; - case 8n: return '9'; - case 9n: return 'A'; - case 10n: return 'B'; - case 11n: return 'C'; - case 12n: return 'D'; - case 13n: return 'E'; - case 14n: return 'F'; - case 15n: return 'G'; - case 16n: return 'H'; - case 17n: return 'J'; - case 18n: return 'K'; - case 19n: return 'L'; - case 20n: return 'M'; - case 21n: return 'N'; - case 22n: return 'P'; - case 23n: return 'Q'; - case 24n: return 'R'; - case 25n: return 'S'; - case 26n: return 'T'; - case 27n: return 'U'; - case 28n: return 'V'; - case 29n: return 'W'; - case 30n: return 'X'; - case 31n: return 'Y'; - case 32n: return 'Z'; - case 33n: return 'a'; - case 34n: return 'b'; - case 35n: return 'c'; - case 36n: return 'd'; - case 37n: return 'e'; - case 38n: return 'f'; - case 39n: return 'g'; - case 40n: return 'h'; - case 41n: return 'i'; - case 42n: return 'j'; - case 43n: return 'k'; - case 44n: return 'm'; - case 45n: return 'n'; - case 46n: return 'o'; - case 47n: return 'p'; - case 48n: return 'q'; - case 49n: return 'r'; - case 50n: return 's'; - case 51n: return 't'; - case 52n: return 'u'; - case 53n: return 'v'; - case 54n: return 'w'; - case 55n: return 'x'; - case 56n: return 'y'; - case 57n: return 'z'; - default: - throw new Error('invalid base58 bigint: ' + n); - } -} - - - -/** - * Base58 character -> integer conversion table - * - * @internal - */ -function -char_to_bigint - (s: string) - : bigint -{ - switch(s) { - case '1': return 0n; - case '2': return 1n; - case '3': return 2n; - case '4': return 3n; - case '5': return 4n; - case '6': return 5n; - case '7': return 6n; - case '8': return 7n; - case '9': return 8n; - case 'A': return 9n; - case 'B': return 10n; - case 'C': return 11n; - case 'D': return 12n; - case 'E': return 13n; - case 'F': return 14n; - case 'G': return 15n; - case 'H': return 16n; - case 'J': return 17n; - case 'K': return 18n; - case 'L': return 19n; - case 'M': return 20n; - case 'N': return 21n; - case 'P': return 22n; - case 'Q': return 23n; - case 'R': return 24n; - case 'S': return 25n; - case 'T': return 26n; - case 'U': return 27n; - case 'V': return 28n; - case 'W': return 29n; - case 'X': return 30n; - case 'Y': return 31n; - case 'Z': return 32n; - case 'a': return 33n; - case 'b': return 34n; - case 'c': return 35n; - case 'd': return 36n; - case 'e': return 37n; - case 'f': return 38n; - case 'g': return 39n; - case 'h': return 40n; - case 'i': return 41n; - case 'j': return 42n; - case 'k': return 43n; - case 'm': return 44n; - case 'n': return 45n; - case 'o': return 46n; - case 'p': return 47n; - case 'q': return 48n; - case 'r': return 49n; - case 's': return 50n; - case 't': return 51n; - case 'u': return 52n; - case 'v': return 53n; - case 'w': return 54n; - case 'x': return 55n; - case 'y': return 56n; - case 'z': return 57n; - default: - throw new Error('invalid base58 char: ' + s); - } -} diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/b64.ts b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/b64.ts deleted file mode 100644 index d82cd73..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/b64.ts +++ /dev/null @@ -1,655 +0,0 @@ -/** - * Base64 Utility Functions in TypeScript - */ - -export { - encode, - decode -} - - - -/** - * Encode an array of bytes as a Uint8Array in base64 notation. - */ -function -encode - (bytes: Uint8Array) - : string -{ - // slice the array - // length of head is a multiple of 3 - // treat the tail as a special case - let {head, tail, tail_len} = slice3k(bytes); - let head_str : string = encode_head(head); - let tail_str : string = encode_tail(tail, tail_len); - return head_str + tail_str; -} - - - -type slice3k - = {head : Uint8Array, - tail : Uint8Array, - tail_len : number}; - -/** - * Take a Uint8Array, take the first 3k (k >= 0) bytes, put them in head, and - * the remaining 0,1, or 2 bytes, put them in tail - * - * @internal - */ -function -slice3k - (bytes: Uint8Array) - : slice3k -{ - let len : number = bytes.length; - // too lazy to look up how to do integer division in js so this will do - let tail_len : number = len % 3; - let head_len : number = len - tail_len; - // for slice: - // first argument is the 0-index of the start - // second - first is the length of the slice - let head : Uint8Array = bytes.slice(0, head_len); - // empty second argument means go to the end - let tail : Uint8Array = bytes.slice(head_len); - return {head : head, - tail : tail, - tail_len : tail_len}; -} - - - -/** - * Encode a Uint8Array whose length is known to be a multiple of 3 - * - * @internal - */ -function -encode_head - (head_bytes: Uint8Array) - : string -{ - // can assume length of bytes is a multiple of 3 - // start index at 0 - // increment by 3 - let head_bytes_len : number = head_bytes.length; - let max_idx0 : number = head_bytes_len - 1; - - let head_str_acc : string = ''; - for(let this_3slice_start_idx0 = 0; - this_3slice_start_idx0 <= max_idx0; - this_3slice_start_idx0 += 3) - { - let this_3slice_bytes : Uint8Array = head_bytes.slice(this_3slice_start_idx0, this_3slice_start_idx0 + 3); - let this_3slice_str : string = encode3(this_3slice_bytes); - head_str_acc += this_3slice_str; - } - - return head_str_acc; -} - - - -/** - * Encode a 3 bytes into base64 notation - * - * @internal - */ -function -encode3 - (bytes: Uint8Array) - : string -{ - let b0 : number = bytes[0]; - let b1 : number = bytes[1]; - let b2 : number = bytes[2]; - - // ABCDEFGH 12345678 abcdefgh - // b0 b1 b2 - // ABCDEF GH1234 5678ab cdefgh - // n0 n1 n2 n3 - let n0 : number = b0 >> 2; - // b0 = ABCDEFGH - // 4 = _____1__ - // b0 % 4 = ______GH - // (b0 % 4) << 4 = __GH____ - // b1 = 12345678 - // b1 >> 4 = ____1234 - // n1 = __GH1234 - let n1 : number = ((b0 % 4) << 4) + (b1 >> 4); - // b1 = 12345678 - // 16 = ___1____ - // b1 % 16 = ____5678 - // (b1 % 16) << 2 = __5678__ - // b2 = abcdefgh - // b2 >> 6 = ______ab - // n2 = __5678ab - let n2 : number = ((b1 % 16) << 2) + (b2 >> 6); - // b2 = abcdefgh - // 64 = _1______ - // n3 = __cdefgh - let n3 : number = b2 % 64; - - // convert to chars - let s0 : string = int2char(n0); - let s1 : string = int2char(n1); - let s2 : string = int2char(n2); - let s3 : string = int2char(n3); - - // retrvn - return s0 + s1 + s2 + s3; -} - - - -/** - * Encode the final 0, 1, or 2 bytes - * - * @internal - */ -function -encode_tail - (tail_bytes : Uint8Array, - tail_len : number) - : string -{ - switch(tail_len) { - case 0: return ''; - case 1: return encode1(tail_bytes); - case 2: return encode2(tail_bytes); - default: - throw new Error('encode_tail with tail_len = ' + tail_len); - } -} - - - -/** - * Encode a single byte - * - * @internal - */ -function -encode1 - (bytes: Uint8Array) - : string -{ - let b0 : number = bytes[0]; - // n0 = __ABCDEF - // b0 = ABCDEFGH - // b0 >> 2 = __ABCDEF - let n0 : number = b0 >> 2; - // n1 = __GH____ - // b0 = ABCDEFGH - // 4 = _____1__ - // b0 % 4 = ______GH - // (b0 % 4) << 4 = __GH____ - let n1 : number = (b0 % 4) << 4; - - return int2char(n0) + int2char(n1) + '=='; -} - - - -/** - * Encode two bytes - * - * @internal - */ -function -encode2 - (bytes: Uint8Array) - : string -{ - let b0 : number = bytes[0]; - let b1 : number = bytes[1]; - - // ABCDEFGH 12345678 - // b0 b1 - // ABCDEF GH1234 5678__ - // n0 n1 n2 - let n0 : number = b0 >> 2; - // b0 = ABCDEFGH - // 4 = _____1__ - // b0 % 4 = ______GH - // (b0 % 4) << 4 = __GH____ - // b1 = 12345678 - // b1 >> 4 = ____1234 - // n1 = __GH1234 - let n1 : number = ((b0 % 4) << 4) + (b1 >> 4); - // b1 = 12345678 - // 16 = ___1____ - // b1 % 16 = ____5678 - // (b1 % 16) << 2 = __5678__ - // n2 = __5678__ - let n2 : number = (b1 % 16) << 2; - - // convert to chars - let s0 : string = int2char(n0); - let s1 : string = int2char(n1); - let s2 : string = int2char(n2); - - // retrvn - return s0 + s1 + s2 + '='; -} - - - -/** - * Decode a base64-encoded string - */ -function -decode - (base64_str : string) - : Uint8Array -{ - // length of the string is guaranteed to be a multiple of 4 - // if the string is empty, return the empty array - let len = base64_str.length; - // this branching contains the implicit assertion that the length is a - // multiple of 4. If this is not true, the bottom branch is triggered. - // general case goes first because speeeeeed - if ( (4 < len) - && (0 === (len % 4))) - { - // split the head and tail - let tail_start_idx0 : number = len - 4; - let head_s : string = base64_str.slice(0, tail_start_idx0); - let tail_s : string = base64_str.slice(tail_start_idx0); - // Using arrays because Uint8Arrays don't have a concat operation - let head_arr : Array = decode_head(head_s); - let tail_arr : Array = decode_tail(tail_s); - // silly to put these in variables but this is exactly the type of - // situation where JS type insanity shows up - // - // see: i forgot - // > [1,2,3] + [4,5,6] - // '1,2,34,5,6' - // - // Originally, I used + like some sort of moron who codes in a sane - // language - // - // seriously what is this language - // - // this is some clown behavior - let total_arr : Array = head_arr.concat(tail_arr); - return new Uint8Array(total_arr); - } - // special case if the length is exactly 4 - else if (4 === len) - { - // it's just a tail - return new Uint8Array(decode_tail(base64_str)); - } - // empty string - else if (0 === len) - { - return new Uint8Array([]); - } - else - { - throw new Error('base64 decode: invalid string length: ' + len); - } -} - - - -/** - * Decode a string known to not have any padding - * - * @internal - */ -function -decode_head - (s: string) - : Array -{ - // go 4 characters at a time - let max_i0 : number = s.length - 1; - let decoded_acc : Array = []; - for(let i0 = 0; - i0 <= max_i0; - i0 += 4) - { - let this_slice_s : string = s.slice(i0, i0 + 4); - let this_slice_arr : Array = decode3(this_slice_s); - // update accumulator - decoded_acc = decoded_acc.concat(this_slice_arr); - } - return decoded_acc; -} - - - -/** - * Decode 4 characters that correspond to either 3 bytes, 2, bytes, or 1 byte - * - * @internal - */ -function -decode_tail - (s: string) - : Array -{ - // all that matters right now is the last 2 chars - // s0, s1, s2, s3 - // 0 based indexing is so annoying - let s2 = s[2]; - let s3 = s[3]; - - // braaaaaaaaaaaaaaaaaench - // two equals signs means 1 byte - if (('=' === s3) && ('=' === s2)) { - return decode1(s); - } - // one equals sign means 2 bytes - else if (('=' === s3)) { - return decode2(s); - } - // 0 equals signs means 3 bytes - else { - return decode3(s); - } -} - - - -/** - * Decode a 4-character long base64 string corresponding to 3 bytes - * - * @internal - */ -function -decode3 - (s: string) - : Array -{ - // pull out strings - let s0 : string = s[0]; - let s1 : string = s[1]; - let s2 : string = s[2]; - let s3 : string = s[3]; - - // convert to numbers - let n0 : number = char2int(s0); - let n1 : number = char2int(s1); - let n2 : number = char2int(s2); - let n3 : number = char2int(s3); - - // abcdef gh1234 5678ab cdefgh - // n0 n1 n2 n3 - // abcdefgh 12345678 abcdefgh - // b0 b1 b2 - - // n0 = __abcdef - // n1 = __gh1234 - // n0 << 2 = abcdef__ - // n1 >> 4 = ______gh - // b0 = abcdefgh - let b0 : number = (n0 << 2) + (n1 >> 4); - // n1 = __gh1234 - // 16 = ___1____ - // n1 % 16 = ____1234 - // (n1 % 16) << 4 = 1234____ - // n2 = __5678ab - // n2 >> 2 = ____5678 - // b1 = 12345678 - let b1 : number = ((n1 % 16) << 4) + (n2 >> 2); - // n2 = __5678ab - // 4 = _____1__ - // n2 % 4 = ______ab - // (n2 % 4) << 6 = ab______ - // n3 = __cdefgh - let b2 : number = ((n2 % 4) << 6) + n3; - - return [b0, b1, b2]; -} - - - -/** - * Decode a 4-character long base64 string corresponding to 2 bytes - * - * @internal - */ -function -decode2 - (s: string) - : Array -{ - // xyz= - // pull out strings - let s0 : string = s[0]; - let s1 : string = s[1]; - let s2 : string = s[2]; - - // convert to numbers - let n0 : number = char2int(s0); - let n1 : number = char2int(s1); - let n2 : number = char2int(s2); - - // abcdef gh1234 5678__ - // n0 n1 n2 - // abcdefgh 12345678 - // b0 b1 - - // n0 = __abcdef - // n1 = __gh1234 - // n0 << 2 = abcdef__ - // n1 >> 4 = ______gh - // b0 = abcdefgh - let b0 : number = (n0 << 2) + (n1 >> 4); - // n1 = __gh1234 - // 16 = ___1____ - // n1 % 16 = ____1234 - // (n1 % 16) << 4 = 1234____ - // n2 = __5678__ - // n2 >> 2 = ____5678 - // b1 = 12345678 - let b1 : number = ((n1 % 16) << 4) + (n2 >> 2); - - return [b0, b1]; -} - - - -/** - * Decode a 4-character long base64 string corresponding to 2 bytes - * - * @internal - */ -function -decode1 - (s: string) - : Array -{ - // xy== - // pull out strings - let s0 : string = s[0]; - let s1 : string = s[1]; - - // convert to numbers - let n0 : number = char2int(s0); - let n1 : number = char2int(s1); - - // abcdef gh____ - // n0 n1 - // abcdefgh - // b0 - - // n0 = __abcdef - // n1 = __gh____ - // n0 << 2 = abcdef__ - // n1 >> 4 = ______gh - // b0 = abcdefgh - let b0 : number = (n0 << 2) + (n1 >> 4); - - return [b0]; -} - - - - -// FIXME: these tables would *probably* be faster if they were made into objects - -/** - * Conversion table for base64 encode - * - * @internal - */ -function -int2char - (n: number) - : string -{ - switch(n) { - case 0: return 'A'; - case 1: return 'B'; - case 2: return 'C'; - case 3: return 'D'; - case 4: return 'E'; - case 5: return 'F'; - case 6: return 'G'; - case 7: return 'H'; - case 8: return 'I'; - case 9: return 'J'; - case 10: return 'K'; - case 11: return 'L'; - case 12: return 'M'; - case 13: return 'N'; - case 14: return 'O'; - case 15: return 'P'; - case 16: return 'Q'; - case 17: return 'R'; - case 18: return 'S'; - case 19: return 'T'; - case 20: return 'U'; - case 21: return 'V'; - case 22: return 'W'; - case 23: return 'X'; - case 24: return 'Y'; - case 25: return 'Z'; - case 26: return 'a'; - case 27: return 'b'; - case 28: return 'c'; - case 29: return 'd'; - case 30: return 'e'; - case 31: return 'f'; - case 32: return 'g'; - case 33: return 'h'; - case 34: return 'i'; - case 35: return 'j'; - case 36: return 'k'; - case 37: return 'l'; - case 38: return 'm'; - case 39: return 'n'; - case 40: return 'o'; - case 41: return 'p'; - case 42: return 'q'; - case 43: return 'r'; - case 44: return 's'; - case 45: return 't'; - case 46: return 'u'; - case 47: return 'v'; - case 48: return 'w'; - case 49: return 'x'; - case 50: return 'y'; - case 51: return 'z'; - case 52: return '0'; - case 53: return '1'; - case 54: return '2'; - case 55: return '3'; - case 56: return '4'; - case 57: return '5'; - case 58: return '6'; - case 59: return '7'; - case 60: return '8'; - case 61: return '9'; - case 62: return '+'; - case 63: return '/'; - default: throw new Error("invalid base64 encode byte: " + n); - } -} - - - -/** - * Conversion table for base64 decode - * - * @internal - */ -function -char2int - (s: string) - : number -{ - switch(s) { - case 'A': return 0; - case 'B': return 1; - case 'C': return 2; - case 'D': return 3; - case 'E': return 4; - case 'F': return 5; - case 'G': return 6; - case 'H': return 7; - case 'I': return 8; - case 'J': return 9; - case 'K': return 10; - case 'L': return 11; - case 'M': return 12; - case 'N': return 13; - case 'O': return 14; - case 'P': return 15; - case 'Q': return 16; - case 'R': return 17; - case 'S': return 18; - case 'T': return 19; - case 'U': return 20; - case 'V': return 21; - case 'W': return 22; - case 'X': return 23; - case 'Y': return 24; - case 'Z': return 25; - case 'a': return 26; - case 'b': return 27; - case 'c': return 28; - case 'd': return 29; - case 'e': return 30; - case 'f': return 31; - case 'g': return 32; - case 'h': return 33; - case 'i': return 34; - case 'j': return 35; - case 'k': return 36; - case 'l': return 37; - case 'm': return 38; - case 'n': return 39; - case 'o': return 40; - case 'p': return 41; - case 'q': return 42; - case 'r': return 43; - case 's': return 44; - case 't': return 45; - case 'u': return 46; - case 'v': return 47; - case 'w': return 48; - case 'x': return 49; - case 'y': return 50; - case 'z': return 51; - case '0': return 52; - case '1': return 53; - case '2': return 54; - case '3': return 55; - case '4': return 56; - case '5': return 57; - case '6': return 58; - case '7': return 59; - case '8': return 60; - case '9': return 61; - case '+': return 62; - case '/': return 63; - default: throw new Error("invalid base64 character: " + s); - } -} diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/bin.ts b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/bin.ts deleted file mode 100644 index 958aa2a..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/bin.ts +++ /dev/null @@ -1,377 +0,0 @@ -/** - * Miscellaneous binary utility functions - * - * @module - */ - -export { - bytes_to_bigint, - bigint_to_bytes, - concat, - strong_rand_bytes -}; - - - -/** - * Concatenate two arrays - */ -function -concat - (arr1 : Uint8Array, - arr2 : Uint8Array) - : Uint8Array -{ - let len1 : number = arr1.length; - let len2 : number = arr2.length; - let arr1_idx0_offset : number = 0; - let arr2_idx0_offset : number = len1; - let result_len : number = len1 + len2; - let result : Uint8Array = new Uint8Array(result_len); - // copy first array into result - for (let arr1_idx0 = 0; - arr1_idx0 < len1; - arr1_idx0++) - { - // no offset here - let result_idx0 : number = arr1_idx0 + arr1_idx0_offset; - result[result_idx0] = arr1[arr1_idx0]; - } - // copy second array into result - for (let arr2_idx0 = 0; - arr2_idx0 < len2; - arr2_idx0++) - { - // offset by the length of the first array - let result_idx0 : number = arr2_idx0 + arr2_idx0_offset; - result[result_idx0] = arr2[arr2_idx0]; - } - return result; -} - - - -/** - * Cryptographically random bytes - */ -function -strong_rand_bytes - (how_many : number) - : Uint8Array -{ - let arr = new Uint8Array(how_many); - (new Crypto()).getRandomValues(arr); - return arr; -} - - - -/** - * Convert a byte array to a bigint - * - * Equivalent to `binary:decode_unsigned/1` from Erlang - */ -function -bytes_to_bigint - (bytes: Uint8Array) - : bigint -{ - let n : bigint = 0n; - for (let b of bytes) { - // move first, then add - // otherwise it ends on a move - // imperative languages are for losers - n <<= 8n; - n += BigInt(b); - } - return n; -} - - - -/** - * Convert a bigint to a byte array - * - * Equivalent to `binary:encode_unsigned/1` from Erlang - * - * Requires input to be positive - */ -function -bigint_to_bytes - (q: bigint) - : Uint8Array -{ - if (q < 0n) { - throw new Error('q < 0n: ' + q); - } - - let arr_reverse = []; - while (q > 0n) { - let r = Number(q % 256n); - q /= 256n; - arr_reverse.push(r); - } - arr_reverse.reverse(); - return new Uint8Array(arr_reverse); -} - - - -/** - * Oh no, bitstrings in a language that only has bytestrings - * - * By convention these are `Uint8Array`s with byte length `ceil(bit_length / - * 8)`, and all trailing bits are zero. - */ -type bits = - {bit_length : number, - bytes : Uint8Array}; - - - -/** - * Get an uninitialized bitstring - * - * @internal - */ -function -bits_null - (bit_length : number) - : bits -{ - let byte_length : number = Math.ceil(bit_length / 8); - let result : Uint8Array = new Uint8Array(byte_length); - return {bit_length : bit_length, - bytes : result}; -} - - - -/** - * Get a bitstring of a given length where every value is 0. - */ -function -bits_zeros - (bit_length : number) - : bits -{ - let byte_length : number = Math.ceil(bit_length / 8); - let result : Uint8Array = new Uint8Array(byte_length); - for (let i0 = 0; - i0 < byte_length; - i0++) - { - result[i0] = 0; - } - return {bit_length : bit_length, - bytes : result}; -} - - - -/** - * Get a bitstring of a given length where every value is 1. - */ -function -bits_ones - (bit_length : number) - : bits -{ - let byte_length : number = Math.ceil(bit_length / 8); - let result : Uint8Array = new Uint8Array(byte_length); - - // fill everything except the last byte with 255s - for (let i0 = 0; - i0 < (byte_length - 1); - i0++) - { - result[i0] = 255; - } - - // alright so the last byte - // ok so the number of leading 0s is - // 8 - (bit_length % 8) - let num_trailing_zero_bits : number = 8 - (bit_length % 8); - // the trailing byte is 255 << that - // e.g. 3 trailing 0s - // 1111_1111 -> 1111_1000 - let last_byte : number = 255 << num_trailing_zero_bits; - let last_byte_idx0 : number = byte_length - 1; - result[last_byte_idx0] = last_byte; - - return {bit_length : bit_length, - bytes : result}; -} - - - -/** - * Get the bit at a given 0-index - */ -function -bits_i0th - (bit_idx0 : number, - bits : bits) - : number -{ - // first task is figuring out what byte we're at - // for instance if we want bit 27 - // 3*8 = 24 =< 27 < 4*8 - // so it's Math.floor(bit_idx0 / 8) - let byte_idx0 : number = Math.floor(bit_idx0 / 8); - // let's fetch the byte and work with that - let the_byte : number = bits.bytes[byte_idx0]; - - // ok so let's go with 27 again - // 27 = 3 mod 8 - // so we bitshift right by (8 - 3) - // and then take the remainder dividing by 2 - // --B-_---- -> ----_---B -> 0000_000B - let bsr : number = 8 - (bit_idx0 % 8); - return (the_byte >> bsr) % 2; -} - - - -/** - * Concatenate two bitstrings - */ -function -bits_concat - (bits1 : bits, - bits2 : bits) - : bits -{ - let result_bit_length : number = bits1.bit_length + bits2.bit_length; - let bytes1 : Uint8Array = bits1.bytes; - let bytes2 : Uint8Array = bits2.bytes; - // using zeros here because of our xor trick in a minute - let result_bits : bits = bits_null(result_bit_length); - let result_bytes : Uint8Array = result_bits.bytes; - - // go along each byte in result, and compute the byte boundary - for (let i = 0; - i < result_bytes.length; - i++) - { - // ABCD_EFGH _ - // 0123_4567 8 - // this is the bit index of the leftmost bit in this byte - let start_bit_bi0 : number = i * 8; - let next_start_bit_bi0 : number = start_bit_bi0 + 8; - // does the bit at the beginning of this byte correspond to the first array? - // strict comparison: - // suppose i = 0, - // suppose bit_length1 is 0 - // then this says no, go to second array - // suppose bl1 = 1, - // this says start at first array - let start_bit_is_of_first_array : boolean = start_bit_bi0 < bits1.bit_length; - // weak comparison: - // suppose bit_length1 = 8 - // ABCD_EFGH _ - // 0123_4567 8 - // ^ - // start_bit_bi0 ^ next_start_bit_bi0 - let stop_bit_is_of_first_array : boolean = next_start_bit_bi0 <= bits1.bit_length; - // is this a bytes1 byte - let is_bytes1_byte : boolean = start_bit_is_of_first_array && stop_bit_is_of_first_array; - let is_boundary_byte : boolean = start_bit_is_of_first_array && !stop_bit_is_of_first_array; - - // need to work out the ping_pong bs up here because js is dumb and I - // can't put lets between elseifs - // alright, now we're in the case of only copying from the second array - // we have two cases: - // ping-pong: - // ABCD_EFGH 1234_5678 - // - ---- --- - // copying these bits - // ping: - // ABCD_EFGH - // - ---- 000 - // - // how to distinguish between these two?? - // - // we're in the ping case when the start_bit_bi0 corresponds to the - // final byte of the second array - // - // ok - // - // we need to compute the bit address in the second array that - // corresponds to the bit address at the beginning of this byte in the - // result array - let bits2_addr_bi0 : number = start_bit_bi0 - bits1.bit_length; - // I think the variable is - // bits_left_to_copy = bits2.bit_length - bit_addr2_bi0 - // no + 1 because the current bit is uncopied, - // so if bit_addr2_bi0 = 7 and bits2.bit_length is 8, it means we - // have the last bit to copy - // cases: - // bits_left_to_copy <= 0 -> - // this would mean we have more bits to copy, but are out of - // source bits. should be impossible if bits_null is correct - // bits_left_to_copy <= 8 -> - // this would mean we are going to fill this last byte in the - // result array with the correct bits from array2, but how we - // do this will depend on how those are arranged in bytes2 - // (whether we grab one or two bytes) - // - // this is the tricky case - // - // I think what matters here is the byte address in the second array - // if we're on the last byte - // 8 < bits_left_to_copy -> - // this means we can safely grab two bytes from bytes2, and do - // our bitshifting to make it correct - // - // FIXME - let bits_left_to_copy : number = bits2.bit_length - bits2_addr_bi0; - // no the variable that matters is which byte we're on in the result - let this_bytes2_addr_i0 : number = Math.floor(bits2_addr_bi0 / 8); - let next_bytes2_addr_i0 : number = this_bytes2_addr_i0 + 1; - let bitshift_amt : number = bits1.bit_length % 8; - - let ping : boolean = next_bytes2_addr_i0 === bytes2.length; - - - // simple case: this is a byte from the first array - // just copy it - if (is_bytes1_byte) - result_bytes[i] = bytes1[i]; - // this is a boundary byte - // further cases: - // second bit length is 0 -> - // ABCD_EF-- - // ^ starting here - // just copy first byte and move along - else if (is_boundary_byte && (bits2.bit_length === 0)) - result_bytes[i] = bytes1[i]; - // boundary byte, and there is at least one byte in the second array - else if (is_boundary_byte) - { - // copy over the first byte - result_bytes[i] = bytes1[i]; - // take the first byte from the second array - let first_byte_of_second_array : number = bytes2[0]; - // bytes1: - // ABCD_EF00 - // 6 - // bytes2: - // 1234_5678 - // 0000_0012 - // and bitshift it right by that amount - let bitshift_amt : number = bits1.bit_length % 8; - result_bytes[i] ^= first_byte_of_second_array >> bitshift_amt; - } - // last byte of second array - else if (ping) - result_bytes[i] = (bytes2[this_bytes2_addr_i0] << bitshift_amt); - // ping-pong: not last byte of second array - else - result_bytes[i] = (bytes2[this_bytes2_addr_i0] << bitshift_amt) ^ (bytes2[next_bytes2_addr_i0] << bitshift_amt); - } - - return {bit_length : result_bit_length, - bytes : result_bytes}; - -} diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/faert.ts b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/faert.ts deleted file mode 100644 index 16c4c43..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/faert.ts +++ /dev/null @@ -1,399 +0,0 @@ -/** - * FÆRT: Fast Æternity Recovery Text - * - * Reference: https://gitlab.com/zxq9/passgas/-/blob/83607fedb08be5dfd03210e331f9c76125bb3467/fullofbeans - * - * @module - */ - -export { - encode, - decode, - byte_of_word, - check_word, - check_byte, - words -} - -import * as safe from './safe.js'; - - - -/** - * Encode a bytestring into FÆRT - */ -function -encode - (bytes : Uint8Array) - : string -{ - // initial accumulator - let words_acc : Array = []; - - // go along each byte and look up the word - // add it to the accumulator - for (let this_byte of bytes) - { - let this_word = words[this_byte]; - words_acc.push(this_word); - } - - // prepend check word to phrase - // yes craig it would be faster to do the check byte inline - // the usage case here is 64 byte strings - // double pass is not a big deal - return check_word(bytes) + ' ' + words_acc.join(' '); -} - - - -/** - * Decode a FAERT string into bytes - */ -function -decode - (faert : string) - : safe.Safe -{ - let all_words : Array = faert.split(' '); - let input_check_word : string = all_words[0]; - let input_words : Array = all_words.slice(1) - - // accumulator - let computed_bytes : Array = []; - - // loop over words and figure out accumulator - for (let this_input_word of input_words) - { - let maybe_this_byte : safe.Safe = byte_of_word(this_input_word); - // if the word is an allowable word, add it to the accumulator - if (maybe_this_byte.ok) - { - let this_byte : number = maybe_this_byte.result; - computed_bytes.push(this_byte); - } - // error case, propagate the error up the call chain - else - return maybe_this_byte; - } - - // at this point, we can assume we correctly decoded all words - // compute the check byte - let computed_bytes_u8s : Uint8Array = new Uint8Array(computed_bytes); - let computed_check_word : string = check_word(computed_bytes_u8s); - - // check if it is correct - // if so, return the computed bytes - if (computed_check_word === input_check_word) - return safe.ok(computed_bytes_u8s); - // otherwise, return an error - else - return safe.error('checksum failure! computed check word: ' + computed_check_word + '; input check word: ' + input_check_word); -} - - - -/** - * given a word, find its index - */ -function -byte_of_word - (word: string) - : safe.Safe -{ - for (let i=0; i<=255; i++) - { - if (word === words[i]) - return safe.ok(i); - } - return safe.error('invalid word: ' + word); -} - - - -/** - * compute the check word of an array - */ -function -check_word - (bytes: Uint8Array) - : string -{ - return words[check_byte(bytes)]; -} - - -/** - * given an array, compute the xor of all the bytes in the array - */ -function -check_byte - (bytes: Uint8Array) - : number -{ - let check_byte = 0; - for (let this_byte of bytes) - check_byte ^= this_byte; - return check_byte; -} - - - -let words = [ - "able", - "abuse", - "acquire", - "adjust", - "agent", - "air", - "alert", - "alpha", - "anger", - "answer", - "any", - "argue", - "around", - "assume", - "asthma", - "aunt", - "awkward", - "balcony", - "barrel", - "because", - "behave", - "bicycle", - "bike", - "blind", - "blouse", - "bonus", - "bottom", - "breeze", - "brother", - "bubble", - "burger", - "butter", - "can", - "cannon", - "cargo", - "catalog", - "caught", - "century", - "chaos", - "chicken", - "churn", - "cinnamon", - "clever", - "clock", - "clown", - "collect", - "conduct", - "convince", - "correct", - "cradle", - "crane", - "crime", - "cross", - "crystal", - "curve", - "daughter", - "debris", - "decrease", - "deny", - "deputy", - "despair", - "diesel", - "dinner", - "distance", - "document", - "donate", - "drama", - "drink", - "dutch", - "earth", - "educate", - "elbow", - "employ", - "endless", - "enlist", - "enter", - "equal", - "eternal", - "example", - "exhibit", - "exotic", - "faculty", - "famous", - "fault", - "feature", - "fiber", - "filter", - "firm", - "flame", - "flush", - "follow", - "forward", - "frame", - "fringe", - "future", - "game", - "gate", - "gift", - "glare", - "glow", - "goat", - "grab", - "grief", - "guilt", - "hand", - "hawk", - "health", - "hen", - "hire", - "honey", - "hover", - "hurry", - "hybrid", - "impose", - "inch", - "inherit", - "injury", - "install", - "iron", - "jazz", - "joke", - "just", - "kit", - "kitchen", - "language", - "laundry", - "leader", - "lend", - "leopard", - "license", - "live", - "lobster", - "lounge", - "magnet", - "mail", - "mansion", - "mass", - "math", - "media", - "message", - "metal", - "misery", - "mix", - "more", - "mountain", - "museum", - "mutual", - "narrow", - "nerve", - "next", - "note", - "obey", - "obtain", - "offer", - "once", - "orange", - "ostrich", - "over", - "owner", - "palace", - "patch", - "pave", - "pen", - "phrase", - "piece", - "pizza", - "plunge", - "polar", - "pool", - "power", - "pretty", - "private", - "protect", - "pulp", - "purity", - "quit", - "quote", - "raise", - "razor", - "recall", - "region", - "relief", - "rent", - "rescue", - "review", - "ride", - "risk", - "roof", - "rough", - "saddle", - "salmon", - "sand", - "scene", - "scrub", - "season", - "seek", - "series", - "shed", - "shoe", - "sick", - "silent", - "situate", - "skill", - "slide", - "slush", - "snack", - "solar", - "soul", - "special", - "sphere", - "spot", - "spy", - "stairs", - "stereo", - "strategy", - "stuff", - "success", - "sunny", - "surge", - "swear", - "symptom", - "tail", - "ten", - "tent", - "theme", - "thumb", - "tiny", - "toe", - "tooth", - "topic", - "trade", - "trash", - "trophy", - "truly", - "tumble", - "typical", - "uncle", - "unfair", - "until", - "upper", - "useless", - "van", - "venue", - "video", - "visa", - "vocal", - "walk", - "waste", - "wedding", - "weekend", - "wide", - "winner", - "wise", - "wood", - "wrist", - "zero" -] diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/rlp.ts b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/rlp.ts deleted file mode 100644 index 8c48b75..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/rlp.ts +++ /dev/null @@ -1,521 +0,0 @@ -/** - * Ethereum Recursive-Length Prefix Encoding implementation - * - * Two reference implementations: - * - * 1. Ethereum Python implementation - * 2. My Erlang implementation (agrees with Ethereum Python in randomized - * tests) - * - * This work can be found in ../test/testgen/ - * - * FIXME: need to have Safe assertions for "i am decoding a list", "i am - * decoding a binary", "I am decoding something with no remainder", etc - * - * @module - */ - -export { - decoded_data, - decode_result, - decode, - encode -} - - -//============================================================================= -//============================================================================= -// DECODING -//============================================================================= -//============================================================================= - - -/** - * Data that RLP can encode. Also the result of decoding. - */ -type decoded_data - = Uint8Array - | Array; - - - -/** - * Decoding can have a remainder - */ -type decode_result - = {decoded_data : decoded_data, - remainder : Uint8Array}; - - - -/** - * Decode an RLP-encoded bytestring into a `decode_result` (decoded data + - * whatever wasn't consumed) - */ -function -decode - (bytes: Uint8Array) - : decode_result -{ - // check the first byte - let first_byte: number = bytes[0]; - let rest : Uint8Array = bytes.slice(1); - // if the first byte is between 0 and 127, that is the data - if - (first_byte <= 127) { - return dr(new Uint8Array([first_byte]), rest); - } - // if the first byte is between 128 and 183 = 128 + 55, it is a bytestring - // and the length is Byte - 128 - else if - (first_byte <= 183) { - let payload_byte_length : number = first_byte - 128; - let payload : Uint8Array = rest.slice(0, payload_byte_length); - let rest2 : Uint8Array = rest.slice(payload_byte_length); - return dr(payload, rest2); - } - // if the first byte is between 184 = 183 + 1 and 191 = 183 + 8, it is a - // bytestring. the byte length of bytestring is FirstByte - 183. Then pull - // out the actual data - else if - (first_byte <= 191) { - let byte_length_of_byte_length : number = first_byte - 183; - let bytes_of_byte_length : Uint8Array = rest.slice(0, byte_length_of_byte_length); - let byte_length : number = bytes_to_number(bytes_of_byte_length); - let bytes : Uint8Array = rest.slice(byte_length_of_byte_length, - byte_length + byte_length_of_byte_length); - let rest2 : Uint8Array = rest.slice(byte_length + byte_length_of_byte_length); - return dr(bytes, rest2); - } - // If the first byte is between 192 and 247 = 192 + 55, it is a list. The - // byte length of the list-payload is FirstByte - 192. Then the list - // payload, which needs to be decoded on its own. - else if - (first_byte <= 247) { - let byte_length_of_list : number = first_byte - 192; - let list_payload : Uint8Array = rest.slice(0, byte_length_of_list); - let list : Array = decode_list(list_payload); - let rest2 : Uint8Array = rest.slice(byte_length_of_list); - return dr(list, rest2); - } - // If the first byte is between 248 = 247 + 1 and 255 = 247 + 8, it is a - // list. The byte length of the byte length of the list-payload is - // FirstByte - 247. Then the byte length of the list. Then the list - // payload, which needs to be decoded on its own. - else { - let byte_length_of_byte_length : number = first_byte - 247; - let bytes_of_byte_length : Uint8Array = rest.slice(0, byte_length_of_byte_length); - let byte_length : number = bytes_to_number(bytes_of_byte_length); - let list_bytes : Uint8Array = rest.slice(byte_length_of_byte_length, - byte_length + byte_length_of_byte_length); - let list : Array = decode_list(list_bytes); - let rest2 : Uint8Array = rest.slice(byte_length + byte_length_of_byte_length); - return dr(list, rest2); - } -} - - - -/** - * Decode a list payload (non-prefixed) into an `Array`. - * - * Repeatedly decodes an element off the list until remainder is empty. - * - * @internal - */ -function -decode_list - (bytes: Uint8Array) - : Array -{ - let arr : Array = []; - while (bytes.length > 0) { - // grab an item off the bytes - let {decoded_data, remainder} = decode(bytes); - // push it - arr.push(decoded_data); - // update bytes - bytes = remainder; - } - return arr; -} - - - -/** - * Convert bytestring to number - * - * @internal - */ -function -bytes_to_number - (bytes: Uint8Array) - : number -{ - let n : number = 0; - for (let b of bytes) - { - n <<= 8; - n += b; - } - return n; -} - - - -/** - * Make a `decode_result` containing the two arguments - * - * @internal - */ -function -dr - (x : decoded_data, - y : Uint8Array) - : decode_result -{ - return {decoded_data : x, - remainder : y}; -} - - - -//============================================================================= -//============================================================================= -// ENCODING -//============================================================================= -//============================================================================= - -/** - * Encode some decoded data - */ -function -encode - (data: decoded_data) - : Uint8Array -{ - // is it an array or data - if - (is_binary(data)) { - return encode_binary(data as Uint8Array); - } - else if - (is_list(data)) { - return encode_list(data as Array); - } - else { - throw new Error('encode told to encode something that is not an array or a binary: ' + data); - } -} - - - -/** - * Encode a binary into RLP - * - * @internal - */ -function -encode_binary - (bytes: Uint8Array) - : Uint8Array -{ - let len: number = bytes.length; - // single byte case when the byte is between 0..127 - // result is the bytestring containing the byte itself - if - ((len === 1) && - (bytes[0] <= 127)){ - return bytes; - } - // if the bytestring is 0..55 bytes long, the first byte in the result is - // 128 + Length, the rest of the result bytestring is the input string - else if - (len <= 55) { - // construct the result - // <<128 + Len, Bytes/binary>> - let result : Uint8Array = new Uint8Array(len + 1); - // first byte is 128 + length - result[0] = 128 + len; - // copy input bytes into result - for (let input_idx0 = 0; - input_idx0 < len; - input_idx0++) - { - let result_idx0 : number = input_idx0 + 1; - result[result_idx0] = bytes[input_idx0]; - } - return result; - } - // if the bytestring is more than 55 bytes long, the first byte is 183 + - // ByteLengthOfByteLength, followed by the byte length, followed by the - // bytes - else { - let len_bytes : Uint8Array = encode_unsigned(len); - let len_bytes_length : number = len_bytes.length; - // total array is - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - let result : Uint8Array = new Uint8Array(1 + len_bytes_length + len); - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - // - // ^ YOU ARE HERE - result[0] = 183 + len_bytes_length; - // copy len_bytes into result - for (let len_bytes_idx0 = 0; - len_bytes_idx0 < len_bytes_length; - len_bytes_idx0++) - { - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - // - // ^ YOU ARE HERE - let result_idx0: number = len_bytes_idx0 + 1; - result[result_idx0] = len_bytes[len_bytes_idx0]; - } - // copy original byte array into result - for (let input_idx0 = 0; - input_idx0 < len; - input_idx0++) - { - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - // - // ^ YOU ARE HERE - let result_idx0: number = input_idx0 + (1 + len_bytes_length); - result[result_idx0] = bytes[input_idx0]; - } - // finally, return the result - return result; - } -} - - - -/** - * Encode a list - * - * @internal - */ -function -encode_list - (list: Array) - : Uint8Array -{ - // first encode every element in the list, then branch - let payloads : Array = list.map(encode); - let payload : Uint8Array = uint8arr_concat(payloads); - let payload_size : number = payload.length; - // if the payload size is in 0..55, then the first byte is 192 + payload - // size, followed by the payload - if - (payload_size <= 55) { - // result: <<(192 + Payload_Size), Payload/binary >>; - // 1 byte payload_size bytes - let result : Uint8Array = new Uint8Array(1 + payload_size); - // result: <<(192 + Payload_Size), Payload/binary >>; - // 1 byte payload_size bytes - // - // ^ YOU ARE HERE - result[0] = 192 + payload_size; - // copy the rest of the payload into result - for (let payload_idx0 = 0; - payload_idx0 < payload_size; - payload_idx0++) - { - // result: <<(192 + Payload_Size), Payload/binary >>; - // 1 byte payload_size bytes - // - // ^ YOU ARE HERE - let result_idx0: number = payload_idx0 + 1; - result[result_idx0] = payload[payload_idx0]; - } - return result; - } - // if the payload size is greater than 55, the first byte is 247 + - // size_of_payload_size, followed by the payload size, followed by the - // payload - else { - // compute the payload size size - let payload_size_bytes : Uint8Array = encode_unsigned(payload_size); - let payload_size_size : number = payload_size_bytes.length; - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - let result: Uint8Array = new Uint8Array(1 + payload_size_size + payload_size); - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - // - // ^ YOU ARE HERE - // first byte is 247 + payload_size_size - result[0] = 247 + payload_size_size; - // copy the payload_size_bytes into result - for (let psb_idx0 = 0; - psb_idx0 < payload_size_size; - psb_idx0++) - { - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - // - // ^ YOU ARE HERE - // offset is 1 byte for this - let result_idx0 : number = psb_idx0 + 1; - result[result_idx0] = payload_size_bytes[psb_idx0]; - } - // copy the payload into result - for (let pb_idx0 = 0; - pb_idx0 < payload_size; - pb_idx0++) - { - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - // - // ^ YOU ARE HERE - // offset is 1 + payload_size_size bytes for this - let result_idx0 : number = pb_idx0 + (1 + payload_size_size); - result[result_idx0] = payload[pb_idx0]; - } - // finally, return result - return result; - } -} - - - -/** - * Encode a number as a bytestring - * - * Not for general use, this assumes the input number is greater than 55 - * - * @internal - */ -function -encode_unsigned - (n: number) - : Uint8Array -{ - // can assume that n initially is greater than 55 - // have to encode it in reverse order - let arr : Array = []; - // repeated division by 256 with remainder - // - // example: suppose bign was 1234 and we were dividing by 10 - // - // iteration 0: - // bign = 1234 - // arr = [] - // --- - // bign / 10 = 123 - // bign % 10 = 4 - // --- - // bign = 123 - // arr = [4] - // - // iteration 1: - // bign = 123 - // arr = [4] - // --- - // bign / 10 = 12 - // bign % 10 = 3 - // --- - // bign = 12 - // arr = [4, 3] - // - // iteration 2: - // bign = 12 - // arr = [4, 3] - // --- - // bign / 10 = 1 - // bign % 10 = 2 - // --- - // bign = 1 - // arr = [4, 3, 2] - // - // iteration 3: - // bign = 1 - // arr = [4, 3, 2] - // --- - // bign / 10 = 0 - // bign % 10 = 1 - // --- - // bign = 0 - // arr = [4, 3, 2, 1] - // - // iteration 4: - // bign = 0 - // arr = [4, 3, 2, 1] - // --- - // DONE - while (n > 0) { - arr.push(n % 256); - n >>= 8; - } - // reverse and make into Uint8Array - arr.reverse(); - return new Uint8Array(arr); -} - - - -/** - * concatenate an array of `Uint8Array`s into a single Uint8Array - * - * @internal - */ -function -uint8arr_concat - (arrs: Array) - : Uint8Array -{ - // total length - let total_len = arrs.reduce(// fold - function (acc_len: number, this_uint8array: Uint8Array): number { - return acc_len + this_uint8array.length; - }, - // initial accumulator - 0); - // start up result - let result : Uint8Array = new Uint8Array(total_len); - let result_idx0 : number = 0; - // concatenate - for (let this_uint8arr of arrs) { - // bytewise copy of this uint8array - for (let this_uint8arr_idx0 = 0; - this_uint8arr_idx0 < this_uint8arr.length; - this_uint8arr_idx0++) - { - // copy byte and increment result idx0 - result[result_idx0] = this_uint8arr[this_uint8arr_idx0]; - result_idx0++; - } - } - return result; -} - -/** - * returns true if input is `instanceof Uint8Array` - * - * @internal - */ -function -is_binary - (x: any) - : boolean -{ - return (x instanceof Uint8Array); -} - - - -/** - * returns true if input is `instanceof Array` - * - * @internal - */ -function -is_list - (x: any) - : boolean -{ - return (x instanceof Array); -} diff --git a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/safe.ts b/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/safe.ts deleted file mode 100644 index b3e4c0c..0000000 --- a/libs/vdk_tests_cases/jex_mindist/dist/jex_include/local-vdk-0.1.0/src/safe.ts +++ /dev/null @@ -1,112 +0,0 @@ -/** - * "Safe" error handling - * - * The idea here is that there are situations where it is known - * - * ```typescript - * type Safe - * = Ok - * | Error; - * - * type Ok - * = {ok : true, - * result : ok_t}; - * - * type Error - * = {ok : false, - * error : err_t}; - * ``` - * - * 1. a given function call is likely to fail - * 2. the likely errors can be enumerated - * - * These are called "positive errors". An example would be a page script - * asking a browser wallet extension to sign a transaction. The following - * errors, among others, are likely: - * - * - the user does not have a wallet installed - * - the user has a wallet but does not have the correct signing key - * - the user rejects the transaction - * - the sign request timed out - * - * These errors should not generate exceptions, as these behaviors are to some - * degree "expected". - */ - -export { - Safe, - Ok, - Error, - ok, - error, - unsafe -} - - -/** - * Type that catches positive errors - */ -type Safe - = Ok - | Error; - - -/** - * Ok type - */ -type Ok - = {ok : true, - result : ok_t}; - - -/** - * Error type - */ -type Error - = {ok : false, - error : err_t}; - - -/** - * Constructs an `Ok` value from a pure value - */ -function -ok - - (x : ok_t) - : Ok -{ - return {ok: true, result: x}; -} - - - -/** - * Constructs an `Error` value from a pure value - */ -function -error - - (x: err_t) - : Error -{ - return {ok: false, error: x}; -} - - - -/** - * Takes a `Safe` value, if `ok`, returns the `ok_t`, or if an error throws the - * `err_t` - */ -function -unsafe - - (x: Safe) - : ok_t -{ - if (x.ok) - return x.result; - else - throw x.error; -} diff --git a/libs/vdk_tests_cases/jex_mindist/dist/rlpcases.d.ts b/libs/vdk_tests_cases/jex_mindist/dist/rlpcases.d.ts index 2782d44..8609ca4 100644 --- a/libs/vdk_tests_cases/jex_mindist/dist/rlpcases.d.ts +++ b/libs/vdk_tests_cases/jex_mindist/dist/rlpcases.d.ts @@ -1,4 +1,4 @@ -import * as rlp from './jex_include/local-vdk-0.1.0/dist/rlp.js'; +import * as rlp from './jex_include/local-vdk_rlp-0.1.0/dist/vdk_rlp.js'; declare type rlpcases = { decoded: rlp.decoded_data; encoded: Uint8Array; diff --git a/libs/vdk_tests_cases/jex_mindist/src/rlpcases.ts b/libs/vdk_tests_cases/jex_mindist/src/rlpcases.ts index 67e6fff..e22aa5d 100644 --- a/libs/vdk_tests_cases/jex_mindist/src/rlpcases.ts +++ b/libs/vdk_tests_cases/jex_mindist/src/rlpcases.ts @@ -1,4 +1,4 @@ -import * as rlp from './jex_include/local-vdk-0.1.0/dist/rlp.js'; +import * as rlp from './jex_include/local-vdk_rlp-0.1.0/dist/vdk_rlp.js'; type rlpcases = {decoded: rlp.decoded_data, encoded: Uint8Array}; diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b58.d.ts b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b58.d.ts deleted file mode 100644 index ce46968..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b58.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Base58 encoding/decoding - */ -export { encode, decode }; -/** - * Encode a Uint8Array into base58 - */ -declare function encode(binary: Uint8Array): string; -/** - * Decode a Base58 string into a Uint8Array - */ -declare function decode(base58: string): Uint8Array; diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b58.js b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b58.js deleted file mode 100644 index e8a7064..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b58.js +++ /dev/null @@ -1,308 +0,0 @@ -/** - * Base58 encoding/decoding - */ -export { encode, decode }; -//============================================================================= -// ENCODING -//============================================================================= -/** - * Encode a Uint8Array into base58 - */ -function encode(binary) { - let num_leading_zeros = nlz(binary); - let rest = binary.slice(num_leading_zeros); - let ones = encode_zeros(num_leading_zeros); - let rest_b58 = encode_rest(rest); - let result = ones + rest_b58; - return result; -} -/** - * count the number of leading zeros in a uint8array - * - * @internal - */ -function nlz(bytes) { - let n = 0; - for (let this_byte of bytes) { - if (0 === this_byte) { - n++; - } - else { - break; - } - } - return n; -} -/** - * Generate a bunch of '1's for however many leading zeros there are - * - * @internal - */ -function encode_zeros(how_many) { - let ones = ''; - for (let i = 1; i <= how_many; i++) { - ones += '1'; - } - return ones; -} -/** - * Encode a Uint8Array that has no leading zeros - * - * @internal - */ -function encode_rest(bytes) { - let bytes_bignum = bytes_to_bigint(bytes); - let result = bignum_to_base58(bytes_bignum); - return result; -} -/** - * Convert a bytestring to a bignum - * - * @internal - */ -function bytes_to_bigint(bytes) { - let acc_bigint = 0n; - for (let this_byte of bytes) { - acc_bigint <<= 8n; - acc_bigint += BigInt(this_byte); - } - return acc_bigint; -} -/** - * Convert a BigInt to Base58 - * - * @internal - */ -function bignum_to_base58(q) { - let s = ''; - while (q !== 0n) { - let this_n = q % 58n; - q /= 58n; - let this_b58_char = bigint_to_char(this_n); - s = this_b58_char + s; - } - return s; -} -//============================================================================= -// DECODING -//============================================================================= -/** - * Decode a Base58 string into a Uint8Array - */ -function decode(base58) { - let num_leading_ones = nlo(base58); - let rest = base58.slice(num_leading_ones); - let zeros = decode_ones(num_leading_ones); - let rest_arr = decode_rest(rest); - let pre_result = zeros.concat(rest_arr); - return new Uint8Array(pre_result); -} -/** - * count the number of leading 1 characters in a uint8array - * - * @internal - */ -function nlo(base58) { - let n = 0; - for (let this_char of base58) { - if ('1' === this_char) { - n++; - } - else { - break; - } - } - return n; -} -/** - * Generate a bunch of '0's for however many leading ones there are - * - * @internal - */ -function decode_ones(how_many) { - let zeros = []; - for (let i = 1; i <= how_many; i++) { - zeros.push(0); - } - return zeros; -} -/** - * Decode a string that has no leading 1s - * - * @internal - */ -function decode_rest(base58) { - let result_bignum = base58_to_bigint(base58); - let result = bigint_to_base256(result_bignum); - return result; -} -/** - * Convert a base58 string to a bignum - * - * @internal - */ -function base58_to_bigint(base58) { - let acc_bigint = 0n; - for (let this_char of base58) { - acc_bigint *= 58n; - acc_bigint += char_to_bigint(this_char); - } - return acc_bigint; -} -/** - * convert a bignum into a byte array - * - * @end - */ -function bigint_to_base256(q) { - let arr_reverse = []; - while (q !== 0n) { - let r = Number(q % 256n); - q /= 256n; - arr_reverse.push(r); - } - arr_reverse.reverse(); - return arr_reverse; -} -//============================================================================= -// TRANSLATION TABLES -//============================================================================= -/** - * Base58 integer -> character conversion table - * - * @internal - */ -function bigint_to_char(n) { - switch (n) { - case 0n: return '1'; - case 1n: return '2'; - case 2n: return '3'; - case 3n: return '4'; - case 4n: return '5'; - case 5n: return '6'; - case 6n: return '7'; - case 7n: return '8'; - case 8n: return '9'; - case 9n: return 'A'; - case 10n: return 'B'; - case 11n: return 'C'; - case 12n: return 'D'; - case 13n: return 'E'; - case 14n: return 'F'; - case 15n: return 'G'; - case 16n: return 'H'; - case 17n: return 'J'; - case 18n: return 'K'; - case 19n: return 'L'; - case 20n: return 'M'; - case 21n: return 'N'; - case 22n: return 'P'; - case 23n: return 'Q'; - case 24n: return 'R'; - case 25n: return 'S'; - case 26n: return 'T'; - case 27n: return 'U'; - case 28n: return 'V'; - case 29n: return 'W'; - case 30n: return 'X'; - case 31n: return 'Y'; - case 32n: return 'Z'; - case 33n: return 'a'; - case 34n: return 'b'; - case 35n: return 'c'; - case 36n: return 'd'; - case 37n: return 'e'; - case 38n: return 'f'; - case 39n: return 'g'; - case 40n: return 'h'; - case 41n: return 'i'; - case 42n: return 'j'; - case 43n: return 'k'; - case 44n: return 'm'; - case 45n: return 'n'; - case 46n: return 'o'; - case 47n: return 'p'; - case 48n: return 'q'; - case 49n: return 'r'; - case 50n: return 's'; - case 51n: return 't'; - case 52n: return 'u'; - case 53n: return 'v'; - case 54n: return 'w'; - case 55n: return 'x'; - case 56n: return 'y'; - case 57n: return 'z'; - default: - throw new Error('invalid base58 bigint: ' + n); - } -} -/** - * Base58 character -> integer conversion table - * - * @internal - */ -function char_to_bigint(s) { - switch (s) { - case '1': return 0n; - case '2': return 1n; - case '3': return 2n; - case '4': return 3n; - case '5': return 4n; - case '6': return 5n; - case '7': return 6n; - case '8': return 7n; - case '9': return 8n; - case 'A': return 9n; - case 'B': return 10n; - case 'C': return 11n; - case 'D': return 12n; - case 'E': return 13n; - case 'F': return 14n; - case 'G': return 15n; - case 'H': return 16n; - case 'J': return 17n; - case 'K': return 18n; - case 'L': return 19n; - case 'M': return 20n; - case 'N': return 21n; - case 'P': return 22n; - case 'Q': return 23n; - case 'R': return 24n; - case 'S': return 25n; - case 'T': return 26n; - case 'U': return 27n; - case 'V': return 28n; - case 'W': return 29n; - case 'X': return 30n; - case 'Y': return 31n; - case 'Z': return 32n; - case 'a': return 33n; - case 'b': return 34n; - case 'c': return 35n; - case 'd': return 36n; - case 'e': return 37n; - case 'f': return 38n; - case 'g': return 39n; - case 'h': return 40n; - case 'i': return 41n; - case 'j': return 42n; - case 'k': return 43n; - case 'm': return 44n; - case 'n': return 45n; - case 'o': return 46n; - case 'p': return 47n; - case 'q': return 48n; - case 'r': return 49n; - case 's': return 50n; - case 't': return 51n; - case 'u': return 52n; - case 'v': return 53n; - case 'w': return 54n; - case 'x': return 55n; - case 'y': return 56n; - case 'z': return 57n; - default: - throw new Error('invalid base58 char: ' + s); - } -} -//# sourceMappingURL=b58.js.map \ No newline at end of file diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b58.js.map b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b58.js.map deleted file mode 100644 index c93be14..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b58.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"b58.js","sourceRoot":"","sources":["../src/b58.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACH,MAAM,EACN,MAAM,EACT,CAAA;AAID,+EAA+E;AAC/E,WAAW;AACX,+EAA+E;AAE/E;;GAEG;AACH,SACA,MAAM,CACD,MAAmB;IAGpB,IAAI,iBAAiB,GAAgB,GAAG,CAAC,MAAM,CAAC,CAAC;IACjD,IAAI,IAAI,GAA6B,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrE,IAAI,IAAI,GAA6B,YAAY,CAAC,iBAAiB,CAAC,CAAC;IACrE,IAAI,QAAQ,GAAyB,WAAW,CAAC,IAAI,CAAC,CAAC;IACvD,IAAI,MAAM,GAA2B,IAAI,GAAG,QAAQ,CAAC;IACrD,OAAO,MAAM,CAAC;AAClB,CAAC;AAID;;;;GAIG;AACH,SACA,GAAG,CACE,KAAiB;IAGlB,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,KAAK,IAAI,SAAS,IAAI,KAAK,EAC3B;QACI,IAAI,CAAC,KAAK,SAAS,EAAE;YAAE,CAAC,EAAE,CAAC;SAAI;aACV;YAAE,MAAM;SAAE;KAClC;IACD,OAAO,CAAC,CAAC;AACb,CAAC;AAID;;;;GAIG;AACH,SACA,YAAY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} \ No newline at end of file diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b64.d.ts b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b64.d.ts deleted file mode 100644 index 6a91552..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b64.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Base64 Utility Functions in TypeScript - */ -export { encode, decode }; -/** - * Encode an array of bytes as a Uint8Array in base64 notation. - */ -declare function encode(bytes: Uint8Array): string; -/** - * Decode a base64-encoded string - */ -declare function decode(base64_str: string): Uint8Array; diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b64.js b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b64.js deleted file mode 100644 index a7f7fc5..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b64.js +++ /dev/null @@ -1,507 +0,0 @@ -/** - * Base64 Utility Functions in TypeScript - */ -export { encode, decode }; -/** - * Encode an array of bytes as a Uint8Array in base64 notation. - */ -function encode(bytes) { - // slice the array - // length of head is a multiple of 3 - // treat the tail as a special case - let { head, tail, tail_len } = slice3k(bytes); - let head_str = encode_head(head); - let tail_str = encode_tail(tail, tail_len); - return head_str + tail_str; -} -/** - * Take a Uint8Array, take the first 3k (k >= 0) bytes, put them in head, and - * the remaining 0,1, or 2 bytes, put them in tail - * - * @internal - */ -function slice3k(bytes) { - let len = bytes.length; - // too lazy to look up how to do integer division in js so this will do - let tail_len = len % 3; - let head_len = len - tail_len; - // for slice: - // first argument is the 0-index of the start - // second - first is the length of the slice - let head = bytes.slice(0, head_len); - // empty second argument means go to the end - let tail = bytes.slice(head_len); - return { head: head, - tail: tail, - tail_len: tail_len }; -} -/** - * Encode a Uint8Array whose length is known to be a multiple of 3 - * - * @internal - */ -function encode_head(head_bytes) { - // can assume length of bytes is a multiple of 3 - // start index at 0 - // increment by 3 - let head_bytes_len = head_bytes.length; - let max_idx0 = head_bytes_len - 1; - let head_str_acc = ''; - for (let this_3slice_start_idx0 = 0; this_3slice_start_idx0 <= max_idx0; this_3slice_start_idx0 += 3) { - let this_3slice_bytes = head_bytes.slice(this_3slice_start_idx0, this_3slice_start_idx0 + 3); - let this_3slice_str = encode3(this_3slice_bytes); - head_str_acc += this_3slice_str; - } - return head_str_acc; -} -/** - * Encode a 3 bytes into base64 notation - * - * @internal - */ -function encode3(bytes) { - let b0 = bytes[0]; - let b1 = bytes[1]; - let b2 = bytes[2]; - // ABCDEFGH 12345678 abcdefgh - // b0 b1 b2 - // ABCDEF GH1234 5678ab cdefgh - // n0 n1 n2 n3 - let n0 = b0 >> 2; - // b0 = ABCDEFGH - // 4 = _____1__ - // b0 % 4 = ______GH - // (b0 % 4) << 4 = __GH____ - // b1 = 12345678 - // b1 >> 4 = ____1234 - // n1 = __GH1234 - let n1 = ((b0 % 4) << 4) + (b1 >> 4); - // b1 = 12345678 - // 16 = ___1____ - // b1 % 16 = ____5678 - // (b1 % 16) << 2 = __5678__ - // b2 = abcdefgh - // b2 >> 6 = ______ab - // n2 = __5678ab - let n2 = ((b1 % 16) << 2) + (b2 >> 6); - // b2 = abcdefgh - // 64 = _1______ - // n3 = __cdefgh - let n3 = b2 % 64; - // convert to chars - let s0 = int2char(n0); - let s1 = int2char(n1); - let s2 = int2char(n2); - let s3 = int2char(n3); - // retrvn - return s0 + s1 + s2 + s3; -} -/** - * Encode the final 0, 1, or 2 bytes - * - * @internal - */ -function encode_tail(tail_bytes, tail_len) { - switch (tail_len) { - case 0: return ''; - case 1: return encode1(tail_bytes); - case 2: return encode2(tail_bytes); - default: - throw new Error('encode_tail with tail_len = ' + tail_len); - } -} -/** - * Encode a single byte - * - * @internal - */ -function encode1(bytes) { - let b0 = bytes[0]; - // n0 = __ABCDEF - // b0 = ABCDEFGH - // b0 >> 2 = __ABCDEF - let n0 = b0 >> 2; - // n1 = __GH____ - // b0 = ABCDEFGH - // 4 = _____1__ - // b0 % 4 = ______GH - // (b0 % 4) << 4 = __GH____ - let n1 = (b0 % 4) << 4; - return int2char(n0) + int2char(n1) + '=='; -} -/** - * Encode two bytes - * - * @internal - */ -function encode2(bytes) { - let b0 = bytes[0]; - let b1 = bytes[1]; - // ABCDEFGH 12345678 - // b0 b1 - // ABCDEF GH1234 5678__ - // n0 n1 n2 - let n0 = b0 >> 2; - // b0 = ABCDEFGH - // 4 = _____1__ - // b0 % 4 = ______GH - // (b0 % 4) << 4 = __GH____ - // b1 = 12345678 - // b1 >> 4 = ____1234 - // n1 = __GH1234 - let n1 = ((b0 % 4) << 4) + (b1 >> 4); - // b1 = 12345678 - // 16 = ___1____ - // b1 % 16 = ____5678 - // (b1 % 16) << 2 = __5678__ - // n2 = __5678__ - let n2 = (b1 % 16) << 2; - // convert to chars - let s0 = int2char(n0); - let s1 = int2char(n1); - let s2 = int2char(n2); - // retrvn - return s0 + s1 + s2 + '='; -} -/** - * Decode a base64-encoded string - */ -function decode(base64_str) { - // length of the string is guaranteed to be a multiple of 4 - // if the string is empty, return the empty array - let len = base64_str.length; - // this branching contains the implicit assertion that the length is a - // multiple of 4. If this is not true, the bottom branch is triggered. - // general case goes first because speeeeeed - if ((4 < len) - && (0 === (len % 4))) { - // split the head and tail - let tail_start_idx0 = len - 4; - let head_s = base64_str.slice(0, tail_start_idx0); - let tail_s = base64_str.slice(tail_start_idx0); - // Using arrays because Uint8Arrays don't have a concat operation - let head_arr = decode_head(head_s); - let tail_arr = decode_tail(tail_s); - // silly to put these in variables but this is exactly the type of - // situation where JS type insanity shows up - // - // see: i forgot - // > [1,2,3] + [4,5,6] - // '1,2,34,5,6' - // - // Originally, I used + like some sort of moron who codes in a sane - // language - // - // seriously what is this language - // - // this is some clown behavior - let total_arr = head_arr.concat(tail_arr); - return new Uint8Array(total_arr); - } - // special case if the length is exactly 4 - else if (4 === len) { - // it's just a tail - return new Uint8Array(decode_tail(base64_str)); - } - // empty string - else if (0 === len) { - return new Uint8Array([]); - } - else { - throw new Error('base64 decode: invalid string length: ' + len); - } -} -/** - * Decode a string known to not have any padding - * - * @internal - */ -function decode_head(s) { - // go 4 characters at a time - let max_i0 = s.length - 1; - let decoded_acc = []; - for (let i0 = 0; i0 <= max_i0; i0 += 4) { - let this_slice_s = s.slice(i0, i0 + 4); - let this_slice_arr = decode3(this_slice_s); - // update accumulator - decoded_acc = decoded_acc.concat(this_slice_arr); - } - return decoded_acc; -} -/** - * Decode 4 characters that correspond to either 3 bytes, 2, bytes, or 1 byte - * - * @internal - */ -function decode_tail(s) { - // all that matters right now is the last 2 chars - // s0, s1, s2, s3 - // 0 based indexing is so annoying - let s2 = s[2]; - let s3 = s[3]; - // braaaaaaaaaaaaaaaaaench - // two equals signs means 1 byte - if (('=' === s3) && ('=' === s2)) { - return decode1(s); - } - // one equals sign means 2 bytes - else if (('=' === s3)) { - return decode2(s); - } - // 0 equals signs means 3 bytes - else { - return decode3(s); - } -} -/** - * Decode a 4-character long base64 string corresponding to 3 bytes - * - * @internal - */ -function decode3(s) { - // pull out strings - let s0 = s[0]; - let s1 = s[1]; - let s2 = s[2]; - let s3 = s[3]; - // convert to numbers - let n0 = char2int(s0); - let n1 = char2int(s1); - let n2 = char2int(s2); - let n3 = char2int(s3); - // abcdef gh1234 5678ab cdefgh - // n0 n1 n2 n3 - // abcdefgh 12345678 abcdefgh - // b0 b1 b2 - // n0 = __abcdef - // n1 = __gh1234 - // n0 << 2 = abcdef__ - // n1 >> 4 = ______gh - // b0 = abcdefgh - let b0 = (n0 << 2) + (n1 >> 4); - // n1 = __gh1234 - // 16 = ___1____ - // n1 % 16 = ____1234 - // (n1 % 16) << 4 = 1234____ - // n2 = __5678ab - // n2 >> 2 = ____5678 - // b1 = 12345678 - let b1 = ((n1 % 16) << 4) + (n2 >> 2); - // n2 = __5678ab - // 4 = _____1__ - // n2 % 4 = ______ab - // (n2 % 4) << 6 = ab______ - // n3 = __cdefgh - let b2 = ((n2 % 4) << 6) + n3; - return [b0, b1, b2]; -} -/** - * Decode a 4-character long base64 string corresponding to 2 bytes - * - * @internal - */ -function decode2(s) { - // xyz= - // pull out strings - let s0 = s[0]; - let s1 = s[1]; - let s2 = s[2]; - // convert to numbers - let n0 = char2int(s0); - let n1 = char2int(s1); - let n2 = char2int(s2); - // abcdef gh1234 5678__ - // n0 n1 n2 - // abcdefgh 12345678 - // b0 b1 - // n0 = __abcdef - // n1 = __gh1234 - // n0 << 2 = abcdef__ - // n1 >> 4 = ______gh - // b0 = abcdefgh - let b0 = (n0 << 2) + (n1 >> 4); - // n1 = __gh1234 - // 16 = ___1____ - // n1 % 16 = ____1234 - // (n1 % 16) << 4 = 1234____ - // n2 = __5678__ - // n2 >> 2 = ____5678 - // b1 = 12345678 - let b1 = ((n1 % 16) << 4) + (n2 >> 2); - return [b0, b1]; -} -/** - * Decode a 4-character long base64 string corresponding to 2 bytes - * - * @internal - */ -function decode1(s) { - // xy== - // pull out strings - let s0 = s[0]; - let s1 = s[1]; - // convert to numbers - let n0 = char2int(s0); - let n1 = char2int(s1); - // abcdef gh____ - // n0 n1 - // abcdefgh - // b0 - // n0 = __abcdef - // n1 = __gh____ - // n0 << 2 = abcdef__ - // n1 >> 4 = ______gh - // b0 = abcdefgh - let b0 = (n0 << 2) + (n1 >> 4); - return [b0]; -} -// FIXME: these tables would *probably* be faster if they were made into objects -/** - * Conversion table for base64 encode - * - * @internal - */ -function int2char(n) { - switch (n) { - case 0: return 'A'; - case 1: return 'B'; - case 2: return 'C'; - case 3: return 'D'; - case 4: return 'E'; - case 5: return 'F'; - case 6: return 'G'; - case 7: return 'H'; - case 8: return 'I'; - case 9: return 'J'; - case 10: return 'K'; - case 11: return 'L'; - case 12: return 'M'; - case 13: return 'N'; - case 14: return 'O'; - case 15: return 'P'; - case 16: return 'Q'; - case 17: return 'R'; - case 18: return 'S'; - case 19: return 'T'; - case 20: return 'U'; - case 21: return 'V'; - case 22: return 'W'; - case 23: return 'X'; - case 24: return 'Y'; - case 25: return 'Z'; - case 26: return 'a'; - case 27: return 'b'; - case 28: return 'c'; - case 29: return 'd'; - case 30: return 'e'; - case 31: return 'f'; - case 32: return 'g'; - case 33: return 'h'; - case 34: return 'i'; - case 35: return 'j'; - case 36: return 'k'; - case 37: return 'l'; - case 38: return 'm'; - case 39: return 'n'; - case 40: return 'o'; - case 41: return 'p'; - case 42: return 'q'; - case 43: return 'r'; - case 44: return 's'; - case 45: return 't'; - case 46: return 'u'; - case 47: return 'v'; - case 48: return 'w'; - case 49: return 'x'; - case 50: return 'y'; - case 51: return 'z'; - case 52: return '0'; - case 53: return '1'; - case 54: return '2'; - case 55: return '3'; - case 56: return '4'; - case 57: return '5'; - case 58: return '6'; - case 59: return '7'; - case 60: return '8'; - case 61: return '9'; - case 62: return '+'; - case 63: return '/'; - default: throw new Error("invalid base64 encode byte: " + n); - } -} -/** - * Conversion table for base64 decode - * - * @internal - */ -function char2int(s) { - switch (s) { - case 'A': return 0; - case 'B': return 1; - case 'C': return 2; - case 'D': return 3; - case 'E': return 4; - case 'F': return 5; - case 'G': return 6; - case 'H': return 7; - case 'I': return 8; - case 'J': return 9; - case 'K': return 10; - case 'L': return 11; - case 'M': return 12; - case 'N': return 13; - case 'O': return 14; - case 'P': return 15; - case 'Q': return 16; - case 'R': return 17; - case 'S': return 18; - case 'T': return 19; - case 'U': return 20; - case 'V': return 21; - case 'W': return 22; - case 'X': return 23; - case 'Y': return 24; - case 'Z': return 25; - case 'a': return 26; - case 'b': return 27; - case 'c': return 28; - case 'd': return 29; - case 'e': return 30; - case 'f': return 31; - case 'g': return 32; - case 'h': return 33; - case 'i': return 34; - case 'j': return 35; - case 'k': return 36; - case 'l': return 37; - case 'm': return 38; - case 'n': return 39; - case 'o': return 40; - case 'p': return 41; - case 'q': return 42; - case 'r': return 43; - case 's': return 44; - case 't': return 45; - case 'u': return 46; - case 'v': return 47; - case 'w': return 48; - case 'x': return 49; - case 'y': return 50; - case 'z': return 51; - case '0': return 52; - case '1': return 53; - case '2': return 54; - case '3': return 55; - case '4': return 56; - case '5': return 57; - case '6': return 58; - case '7': return 59; - case '8': return 60; - case '9': return 61; - case '+': return 62; - case '/': return 63; - default: throw new Error("invalid base64 character: " + s); - } -} -//# sourceMappingURL=b64.js.map \ No newline at end of file diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b64.js.map b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b64.js.map deleted file mode 100644 index 7398ad3..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/b64.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"b64.js","sourceRoot":"","sources":["../src/b64.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACH,MAAM,EACN,MAAM,EACT,CAAA;AAID;;GAEG;AACH,SACA,MAAM,CACD,KAAiB;IAGlB,kBAAkB;IAClB,oCAAoC;IACpC,mCAAmC;IACnC,IAAI,EAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC5C,IAAI,QAAQ,GAAY,WAAW,CAAC,IAAI,CAAC,CAAC;IAC1C,IAAI,QAAQ,GAAY,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACpD,OAAO,QAAQ,GAAG,QAAQ,CAAC;AAC/B,CAAC;AASD;;;;;GAKG;AACH,SACA,OAAO,CACF,KAAiB;IAGlB,IAAI,GAAG,GAAiB,KAAK,CAAC,MAAM,CAAC;IACrC,uEAAuE;IACvE,IAAI,QAAQ,GAAY,GAAG,GAAG,CAAC,CAAC;IAChC,IAAI,QAAQ,GAAY,GAAG,GAAG,QAAQ,CAAC;IACvC,aAAa;IACb,6CAA6C;IAC7C,4CAA4C;IAC5C,IAAI,IAAI,GAAgB,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IACjD,4CAA4C;IAC5C,IAAI,IAAI,GAAgB,KAAK,CAAC,KAAK,CAAC,QAAQ,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AAO,EAAE,CAAC;QACpB,KAAK,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC;QACpB,KAAK,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC;QACpB,KAAK,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC;QACpB,KAAK,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,CAAC,CAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,GAAG,CAAC,CAAC,CAAC;KAC/D;AACL,CAAC"} \ No newline at end of file diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/bin.d.ts b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/bin.d.ts deleted file mode 100644 index 915e4ce..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/bin.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Miscellaneous binary utility functions - * - * @module - */ -export { bytes_to_bigint, bigint_to_bytes, concat, strong_rand_bytes }; -/** - * Concatenate two arrays - */ -declare function concat(arr1: Uint8Array, arr2: Uint8Array): Uint8Array; -/** - * Cryptographically random bytes - */ -declare function strong_rand_bytes(how_many: number): Uint8Array; -/** - * Convert a byte array to a bigint - * - * Equivalent to `binary:decode_unsigned/1` from Erlang - */ -declare function bytes_to_bigint(bytes: Uint8Array): bigint; -/** - * Convert a bigint to a byte array - * - * Equivalent to `binary:encode_unsigned/1` from Erlang - * - * Requires input to be positive - */ -declare function bigint_to_bytes(q: bigint): Uint8Array; diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/bin.js b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/bin.js deleted file mode 100644 index 2841b74..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/bin.js +++ /dev/null @@ -1,266 +0,0 @@ -/** - * Miscellaneous binary utility functions - * - * @module - */ -export { bytes_to_bigint, bigint_to_bytes, concat, strong_rand_bytes }; -/** - * Concatenate two arrays - */ -function concat(arr1, arr2) { - let len1 = arr1.length; - let len2 = arr2.length; - let arr1_idx0_offset = 0; - let arr2_idx0_offset = len1; - let result_len = len1 + len2; - let result = new Uint8Array(result_len); - // copy first array into result - for (let arr1_idx0 = 0; arr1_idx0 < len1; arr1_idx0++) { - // no offset here - let result_idx0 = arr1_idx0 + arr1_idx0_offset; - result[result_idx0] = arr1[arr1_idx0]; - } - // copy second array into result - for (let arr2_idx0 = 0; arr2_idx0 < len2; arr2_idx0++) { - // offset by the length of the first array - let result_idx0 = arr2_idx0 + arr2_idx0_offset; - result[result_idx0] = arr2[arr2_idx0]; - } - return result; -} -/** - * Cryptographically random bytes - */ -function strong_rand_bytes(how_many) { - let arr = new Uint8Array(how_many); - (new Crypto()).getRandomValues(arr); - return arr; -} -/** - * Convert a byte array to a bigint - * - * Equivalent to `binary:decode_unsigned/1` from Erlang - */ -function bytes_to_bigint(bytes) { - let n = 0n; - for (let b of bytes) { - // move first, then add - // otherwise it ends on a move - // imperative languages are for losers - n <<= 8n; - n += BigInt(b); - } - return n; -} -/** - * Convert a bigint to a byte array - * - * Equivalent to `binary:encode_unsigned/1` from Erlang - * - * Requires input to be positive - */ -function bigint_to_bytes(q) { - if (q < 0n) { - throw new Error('q < 0n: ' + q); - } - let arr_reverse = []; - while (q > 0n) { - let r = Number(q % 256n); - q /= 256n; - arr_reverse.push(r); - } - arr_reverse.reverse(); - return new Uint8Array(arr_reverse); -} -/** - * Get an uninitialized bitstring - * - * @internal - */ -function bits_null(bit_length) { - let byte_length = Math.ceil(bit_length / 8); - let result = new Uint8Array(byte_length); - return { bit_length: bit_length, - bytes: result }; -} -/** - * Get a bitstring of a given length where every value is 0. - */ -function bits_zeros(bit_length) { - let byte_length = Math.ceil(bit_length / 8); - let result = new Uint8Array(byte_length); - for (let i0 = 0; i0 < byte_length; i0++) { - result[i0] = 0; - } - return { bit_length: bit_length, - bytes: result }; -} -/** - * Get a bitstring of a given length where every value is 1. - */ -function bits_ones(bit_length) { - let byte_length = Math.ceil(bit_length / 8); - let result = new Uint8Array(byte_length); - // fill everything except the last byte with 255s - for (let i0 = 0; i0 < (byte_length - 1); i0++) { - result[i0] = 255; - } - // alright so the last byte - // ok so the number of leading 0s is - // 8 - (bit_length % 8) - let num_trailing_zero_bits = 8 - (bit_length % 8); - // the trailing byte is 255 << that - // e.g. 3 trailing 0s - // 1111_1111 -> 1111_1000 - let last_byte = 255 << num_trailing_zero_bits; - let last_byte_idx0 = byte_length - 1; - result[last_byte_idx0] = last_byte; - return { bit_length: bit_length, - bytes: result }; -} -/** - * Get the bit at a given 0-index - */ -function bits_i0th(bit_idx0, bits) { - // first task is figuring out what byte we're at - // for instance if we want bit 27 - // 3*8 = 24 =< 27 < 4*8 - // so it's Math.floor(bit_idx0 / 8) - let byte_idx0 = Math.floor(bit_idx0 / 8); - // let's fetch the byte and work with that - let the_byte = bits.bytes[byte_idx0]; - // ok so let's go with 27 again - // 27 = 3 mod 8 - // so we bitshift right by (8 - 3) - // and then take the remainder dividing by 2 - // --B-_---- -> ----_---B -> 0000_000B - let bsr = 8 - (bit_idx0 % 8); - return (the_byte >> bsr) % 2; -} -/** - * Concatenate two bitstrings - */ -function bits_concat(bits1, bits2) { - let result_bit_length = bits1.bit_length + bits2.bit_length; - let bytes1 = bits1.bytes; - let bytes2 = bits2.bytes; - // using zeros here because of our xor trick in a minute - let result_bits = bits_null(result_bit_length); - let result_bytes = result_bits.bytes; - // go along each byte in result, and compute the byte boundary - for (let i = 0; i < result_bytes.length; i++) { - // ABCD_EFGH _ - // 0123_4567 8 - // this is the bit index of the leftmost bit in this byte - let start_bit_bi0 = i * 8; - let next_start_bit_bi0 = start_bit_bi0 + 8; - // does the bit at the beginning of this byte correspond to the first array? - // strict comparison: - // suppose i = 0, - // suppose bit_length1 is 0 - // then this says no, go to second array - // suppose bl1 = 1, - // this says start at first array - let start_bit_is_of_first_array = start_bit_bi0 < bits1.bit_length; - // weak comparison: - // suppose bit_length1 = 8 - // ABCD_EFGH _ - // 0123_4567 8 - // ^ - // start_bit_bi0 ^ next_start_bit_bi0 - let stop_bit_is_of_first_array = next_start_bit_bi0 <= bits1.bit_length; - // is this a bytes1 byte - let is_bytes1_byte = start_bit_is_of_first_array && stop_bit_is_of_first_array; - let is_boundary_byte = start_bit_is_of_first_array && !stop_bit_is_of_first_array; - // need to work out the ping_pong bs up here because js is dumb and I - // can't put lets between elseifs - // alright, now we're in the case of only copying from the second array - // we have two cases: - // ping-pong: - // ABCD_EFGH 1234_5678 - // - ---- --- - // copying these bits - // ping: - // ABCD_EFGH - // - ---- 000 - // - // how to distinguish between these two?? - // - // we're in the ping case when the start_bit_bi0 corresponds to the - // final byte of the second array - // - // ok - // - // we need to compute the bit address in the second array that - // corresponds to the bit address at the beginning of this byte in the - // result array - let bits2_addr_bi0 = start_bit_bi0 - bits1.bit_length; - // I think the variable is - // bits_left_to_copy = bits2.bit_length - bit_addr2_bi0 - // no + 1 because the current bit is uncopied, - // so if bit_addr2_bi0 = 7 and bits2.bit_length is 8, it means we - // have the last bit to copy - // cases: - // bits_left_to_copy <= 0 -> - // this would mean we have more bits to copy, but are out of - // source bits. should be impossible if bits_null is correct - // bits_left_to_copy <= 8 -> - // this would mean we are going to fill this last byte in the - // result array with the correct bits from array2, but how we - // do this will depend on how those are arranged in bytes2 - // (whether we grab one or two bytes) - // - // this is the tricky case - // - // I think what matters here is the byte address in the second array - // if we're on the last byte - // 8 < bits_left_to_copy -> - // this means we can safely grab two bytes from bytes2, and do - // our bitshifting to make it correct - // - // FIXME - let bits_left_to_copy = bits2.bit_length - bits2_addr_bi0; - // no the variable that matters is which byte we're on in the result - let this_bytes2_addr_i0 = Math.floor(bits2_addr_bi0 / 8); - let next_bytes2_addr_i0 = this_bytes2_addr_i0 + 1; - let bitshift_amt = bits1.bit_length % 8; - let ping = next_bytes2_addr_i0 === bytes2.length; - // simple case: this is a byte from the first array - // just copy it - if (is_bytes1_byte) - result_bytes[i] = bytes1[i]; - // this is a boundary byte - // further cases: - // second bit length is 0 -> - // ABCD_EF-- - // ^ starting here - // just copy first byte and move along - else if (is_boundary_byte && (bits2.bit_length === 0)) - result_bytes[i] = bytes1[i]; - // boundary byte, and there is at least one byte in the second array - else if (is_boundary_byte) { - // copy over the first byte - result_bytes[i] = bytes1[i]; - // take the first byte from the second array - let first_byte_of_second_array = bytes2[0]; - // bytes1: - // ABCD_EF00 - // 6 - // bytes2: - // 1234_5678 - // 0000_0012 - // and bitshift it right by that amount - let bitshift_amt = bits1.bit_length % 8; - result_bytes[i] ^= first_byte_of_second_array >> bitshift_amt; - } - // last byte of second array - else if (ping) - result_bytes[i] = (bytes2[this_bytes2_addr_i0] << bitshift_amt); - // ping-pong: not last byte of second array - else - result_bytes[i] = (bytes2[this_bytes2_addr_i0] << bitshift_amt) ^ (bytes2[next_bytes2_addr_i0] << bitshift_amt); - } - return { bit_length: result_bit_length, - bytes: result_bytes }; -} -//# sourceMappingURL=bin.js.map \ No newline at end of file diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/bin.js.map b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/bin.js.map deleted file mode 100644 index a87fc4d..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/bin.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACH,eAAe,EACf,eAAe,EACf,MAAM,EACN,iBAAiB,EACpB,CAAC;AAIF;;GAEG;AACH,SACA,MAAM,CACD,IAAiB,EACjB,IAAiB;IAGlB,IAAI,IAAI,GAA4B,IAAI,CAAC,MAAM,CAAC;IAChD,IAAI,IAAI,GAA4B,IAAI,CAAC,MAAM,CAAC;IAChD,IAAI,gBAAgB,GAAgB,CAAC,CAAC;IACtC,IAAI,gBAAgB,GAAgB,IAAI,CAAC;IACzC,IAAI,UAAU,GAAsB,IAAI,GAAG,I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,IAAI,YAAY,GAAY,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC;YACjD,YAAY,CAAC,CAAC,CAAC,IAAI,0BAA0B,IAAI,YAAY,CAAC;SACjE;QACD,4BAA4B;aACvB,IAAI,IAAI;YACT,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,YAAY,CAAC,CAAC;QACpE,2CAA2C;;YAEvC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,YAAY,CAAC,CAAC;KACvH;IAED,OAAO,EAAC,UAAU,EAAG,iBAAiB;QAC9B,KAAK,EAAQ,YAAY,EAAC,CAAC;AAEvC,CAAC"} \ No newline at end of file diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/faert.d.ts b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/faert.d.ts deleted file mode 100644 index fca75f5..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/faert.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * FÆRT: Fast Æternity Recovery Text - * - * Reference: https://gitlab.com/zxq9/passgas/-/blob/83607fedb08be5dfd03210e331f9c76125bb3467/fullofbeans - * - * @module - */ -export { encode, decode, byte_of_word, check_word, check_byte, words }; -import * as safe from './safe.js'; -/** - * Encode a bytestring into FÆRT - */ -declare function encode(bytes: Uint8Array): string; -/** - * Decode a FAERT string into bytes - */ -declare function decode(faert: string): safe.Safe; -/** - * given a word, find its index - */ -declare function byte_of_word(word: string): safe.Safe; -/** - * compute the check word of an array - */ -declare function check_word(bytes: Uint8Array): string; -/** - * given an array, compute the xor of all the bytes in the array - */ -declare function check_byte(bytes: Uint8Array): number; -declare let words: string[]; diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/faert.js b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/faert.js deleted file mode 100644 index 58a5ba3..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/faert.js +++ /dev/null @@ -1,344 +0,0 @@ -/** - * FÆRT: Fast Æternity Recovery Text - * - * Reference: https://gitlab.com/zxq9/passgas/-/blob/83607fedb08be5dfd03210e331f9c76125bb3467/fullofbeans - * - * @module - */ -export { encode, decode, byte_of_word, check_word, check_byte, words }; -import * as safe from './safe.js'; -/** - * Encode a bytestring into FÆRT - */ -function encode(bytes) { - // initial accumulator - let words_acc = []; - // go along each byte and look up the word - // add it to the accumulator - for (let this_byte of bytes) { - let this_word = words[this_byte]; - words_acc.push(this_word); - } - // prepend check word to phrase - // yes craig it would be faster to do the check byte inline - // the usage case here is 64 byte strings - // double pass is not a big deal - return check_word(bytes) + ' ' + words_acc.join(' '); -} -/** - * Decode a FAERT string into bytes - */ -function decode(faert) { - let all_words = faert.split(' '); - let input_check_word = all_words[0]; - let input_words = all_words.slice(1); - // accumulator - let computed_bytes = []; - // loop over words and figure out accumulator - for (let this_input_word of input_words) { - let maybe_this_byte = byte_of_word(this_input_word); - // if the word is an allowable word, add it to the accumulator - if (maybe_this_byte.ok) { - let this_byte = maybe_this_byte.result; - computed_bytes.push(this_byte); - } - // error case, propagate the error up the call chain - else - return maybe_this_byte; - } - // at this point, we can assume we correctly decoded all words - // compute the check byte - let computed_bytes_u8s = new Uint8Array(computed_bytes); - let computed_check_word = check_word(computed_bytes_u8s); - // check if it is correct - // if so, return the computed bytes - if (computed_check_word === input_check_word) - return safe.ok(computed_bytes_u8s); - // otherwise, return an error - else - return safe.error('checksum failure! computed check word: ' + computed_check_word + '; input check word: ' + input_check_word); -} -/** - * given a word, find its index - */ -function byte_of_word(word) { - for (let i = 0; i <= 255; i++) { - if (word === words[i]) - return safe.ok(i); - } - return safe.error('invalid word: ' + word); -} -/** - * compute the check word of an array - */ -function check_word(bytes) { - return words[check_byte(bytes)]; -} -/** - * given an array, compute the xor of all the bytes in the array - */ -function check_byte(bytes) { - let check_byte = 0; - for (let this_byte of bytes) - check_byte ^= this_byte; - return check_byte; -} -let words = [ - "able", - "abuse", - "acquire", - "adjust", - "agent", - "air", - "alert", - "alpha", - "anger", - "answer", - "any", - "argue", - "around", - "assume", - "asthma", - "aunt", - "awkward", - "balcony", - "barrel", - "because", - "behave", - "bicycle", - "bike", - "blind", - "blouse", - "bonus", - "bottom", - "breeze", - "brother", - "bubble", - "burger", - "butter", - "can", - "cannon", - "cargo", - "catalog", - "caught", - "century", - "chaos", - "chicken", - "churn", - "cinnamon", - "clever", - "clock", - "clown", - "collect", - "conduct", - "convince", - "correct", - "cradle", - "crane", - "crime", - "cross", - "crystal", - "curve", - "daughter", - "debris", - "decrease", - "deny", - "deputy", - "despair", - "diesel", - "dinner", - "distance", - "document", - "donate", - "drama", - "drink", - "dutch", - "earth", - "educate", - "elbow", - "employ", - "endless", - "enlist", - "enter", - "equal", - "eternal", - "example", - "exhibit", - "exotic", - "faculty", - "famous", - "fault", - "feature", - "fiber", - "filter", - "firm", - "flame", - "flush", - "follow", - "forward", - "frame", - "fringe", - "future", - "game", - "gate", - "gift", - "glare", - "glow", - "goat", - "grab", - "grief", - "guilt", - "hand", - "hawk", - "health", - "hen", - "hire", - "honey", - "hover", - "hurry", - "hybrid", - "impose", - "inch", - "inherit", - "injury", - "install", - "iron", - "jazz", - "joke", - "just", - "kit", - "kitchen", - "language", - "laundry", - "leader", - "lend", - "leopard", - "license", - "live", - "lobster", - "lounge", - "magnet", - "mail", - "mansion", - "mass", - "math", - "media", - "message", - "metal", - "misery", - "mix", - "more", - "mountain", - "museum", - "mutual", - "narrow", - "nerve", - "next", - "note", - "obey", - "obtain", - "offer", - "once", - "orange", - "ostrich", - "over", - "owner", - "palace", - "patch", - "pave", - "pen", - "phrase", - "piece", - "pizza", - "plunge", - "polar", - "pool", - "power", - "pretty", - "private", - "protect", - "pulp", - "purity", - "quit", - "quote", - "raise", - "razor", - "recall", - "region", - "relief", - "rent", - "rescue", - "review", - "ride", - "risk", - "roof", - "rough", - "saddle", - "salmon", - "sand", - "scene", - "scrub", - "season", - "seek", - "series", - "shed", - "shoe", - "sick", - "silent", - "situate", - "skill", - "slide", - "slush", - "snack", - "solar", - "soul", - "special", - "sphere", - "spot", - "spy", - "stairs", - "stereo", - "strategy", - "stuff", - "success", - "sunny", - "surge", - "swear", - "symptom", - "tail", - "ten", - "tent", - "theme", - "thumb", - "tiny", - "toe", - "tooth", - "topic", - "trade", - "trash", - "trophy", - "truly", - "tumble", - "typical", - "uncle", - "unfair", - "until", - "upper", - "useless", - "van", - "venue", - "video", - "visa", - "vocal", - "walk", - "waste", - "wedding", - "weekend", - "wide", - "winner", - "wise", - "wood", - "wrist", - "zero" -]; -//# sourceMappingURL=faert.js.map \ No newline at end of file diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/faert.js.map b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/faert.js.map deleted file mode 100644 index c7d5d90..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/faert.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"faert.js","sourceRoot":"","sources":["../src/faert.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACH,MAAM,EACN,MAAM,EACN,YAAY,EACZ,UAAU,EACV,UAAU,EACV,KAAK,EACR,CAAA;AAED,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAIlC;;GAEG;AACH,SACA,MAAM,CACD,KAAkB;IAGnB,sBAAsB;IACtB,IAAI,SAAS,GAAoB,EAAE,CAAC;IAEpC,0CAA0C;IAC1C,4BAA4B;IAC5B,KAAK,IAAI,SAAS,IAAI,KAAK,EAC3B;QACI,IAAI,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;QACjC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;KAC7B;IAED,+BAA+B;IAC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AAS;IACT,MAAM;IACN,QAAQ;IACR,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;IACP,OAAO;IACP,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,MAAM;IACN,MAAM;IACN,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,MAAM;IACN,SAAS;IACT,QAAQ;IACR,MAAM;IACN,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,OAAO;IACP,SAAS;IACT,OAAO;IACP,OAAO;IACP,OAAO;IACP,SAAS;IACT,MAAM;IACN,KAAK;IACL,MAAM;IACN,OAAO;IACP,OAAO;IACP,MAAM;IACN,KAAK;IACL,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,SAAS;IACT,OAAO;IACP,QAAQ;IACR,OAAO;IACP,OAAO;IACP,SAAS;IACT,KAAK;IACL,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,SAAS;IACT,SAAS;IACT,MAAM;IACN,QAAQ;IACR,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;CACT,CAAA"} \ No newline at end of file diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/rlp.d.ts b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/rlp.d.ts deleted file mode 100644 index 2072aec..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/rlp.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Ethereum Recursive-Length Prefix Encoding implementation - * - * Two reference implementations: - * - * 1. Ethereum Python implementation - * 2. My Erlang implementation (agrees with Ethereum Python in randomized - * tests) - * - * This work can be found in ../test/testgen/ - * - * FIXME: need to have Safe assertions for "i am decoding a list", "i am - * decoding a binary", "I am decoding something with no remainder", etc - * - * @module - */ -export { decoded_data, decode_result, decode, encode }; -/** - * Data that RLP can encode. Also the result of decoding. - */ -declare type decoded_data = Uint8Array | Array; -/** - * Decoding can have a remainder - */ -declare type decode_result = { - decoded_data: decoded_data; - remainder: Uint8Array; -}; -/** - * Decode an RLP-encoded bytestring into a `decode_result` (decoded data + - * whatever wasn't consumed) - */ -declare function decode(bytes: Uint8Array): decode_result; -/** - * Encode some decoded data - */ -declare function encode(data: decoded_data): Uint8Array; diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/rlp.js b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/rlp.js deleted file mode 100644 index 0aa5213..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/rlp.js +++ /dev/null @@ -1,382 +0,0 @@ -/** - * Ethereum Recursive-Length Prefix Encoding implementation - * - * Two reference implementations: - * - * 1. Ethereum Python implementation - * 2. My Erlang implementation (agrees with Ethereum Python in randomized - * tests) - * - * This work can be found in ../test/testgen/ - * - * FIXME: need to have Safe assertions for "i am decoding a list", "i am - * decoding a binary", "I am decoding something with no remainder", etc - * - * @module - */ -export { decode, encode }; -/** - * Decode an RLP-encoded bytestring into a `decode_result` (decoded data + - * whatever wasn't consumed) - */ -function decode(bytes) { - // check the first byte - let first_byte = bytes[0]; - let rest = bytes.slice(1); - // if the first byte is between 0 and 127, that is the data - if (first_byte <= 127) { - return dr(new Uint8Array([first_byte]), rest); - } - // if the first byte is between 128 and 183 = 128 + 55, it is a bytestring - // and the length is Byte - 128 - else if (first_byte <= 183) { - let payload_byte_length = first_byte - 128; - let payload = rest.slice(0, payload_byte_length); - let rest2 = rest.slice(payload_byte_length); - return dr(payload, rest2); - } - // if the first byte is between 184 = 183 + 1 and 191 = 183 + 8, it is a - // bytestring. the byte length of bytestring is FirstByte - 183. Then pull - // out the actual data - else if (first_byte <= 191) { - let byte_length_of_byte_length = first_byte - 183; - let bytes_of_byte_length = rest.slice(0, byte_length_of_byte_length); - let byte_length = bytes_to_number(bytes_of_byte_length); - let bytes = rest.slice(byte_length_of_byte_length, byte_length + byte_length_of_byte_length); - let rest2 = rest.slice(byte_length + byte_length_of_byte_length); - return dr(bytes, rest2); - } - // If the first byte is between 192 and 247 = 192 + 55, it is a list. The - // byte length of the list-payload is FirstByte - 192. Then the list - // payload, which needs to be decoded on its own. - else if (first_byte <= 247) { - let byte_length_of_list = first_byte - 192; - let list_payload = rest.slice(0, byte_length_of_list); - let list = decode_list(list_payload); - let rest2 = rest.slice(byte_length_of_list); - return dr(list, rest2); - } - // If the first byte is between 248 = 247 + 1 and 255 = 247 + 8, it is a - // list. The byte length of the byte length of the list-payload is - // FirstByte - 247. Then the byte length of the list. Then the list - // payload, which needs to be decoded on its own. - else { - let byte_length_of_byte_length = first_byte - 247; - let bytes_of_byte_length = rest.slice(0, byte_length_of_byte_length); - let byte_length = bytes_to_number(bytes_of_byte_length); - let list_bytes = rest.slice(byte_length_of_byte_length, byte_length + byte_length_of_byte_length); - let list = decode_list(list_bytes); - let rest2 = rest.slice(byte_length + byte_length_of_byte_length); - return dr(list, rest2); - } -} -/** - * Decode a list payload (non-prefixed) into an `Array`. - * - * Repeatedly decodes an element off the list until remainder is empty. - * - * @internal - */ -function decode_list(bytes) { - let arr = []; - while (bytes.length > 0) { - // grab an item off the bytes - let { decoded_data, remainder } = decode(bytes); - // push it - arr.push(decoded_data); - // update bytes - bytes = remainder; - } - return arr; -} -/** - * Convert bytestring to number - * - * @internal - */ -function bytes_to_number(bytes) { - let n = 0; - for (let b of bytes) { - n <<= 8; - n += b; - } - return n; -} -/** - * Make a `decode_result` containing the two arguments - * - * @internal - */ -function dr(x, y) { - return { decoded_data: x, - remainder: y }; -} -//============================================================================= -//============================================================================= -// ENCODING -//============================================================================= -//============================================================================= -/** - * Encode some decoded data - */ -function encode(data) { - // is it an array or data - if (is_binary(data)) { - return encode_binary(data); - } - else if (is_list(data)) { - return encode_list(data); - } - else { - throw new Error('encode told to encode something that is not an array or a binary: ' + data); - } -} -/** - * Encode a binary into RLP - * - * @internal - */ -function encode_binary(bytes) { - let len = bytes.length; - // single byte case when the byte is between 0..127 - // result is the bytestring containing the byte itself - if ((len === 1) && - (bytes[0] <= 127)) { - return bytes; - } - // if the bytestring is 0..55 bytes long, the first byte in the result is - // 128 + Length, the rest of the result bytestring is the input string - else if (len <= 55) { - // construct the result - // <<128 + Len, Bytes/binary>> - let result = new Uint8Array(len + 1); - // first byte is 128 + length - result[0] = 128 + len; - // copy input bytes into result - for (let input_idx0 = 0; input_idx0 < len; input_idx0++) { - let result_idx0 = input_idx0 + 1; - result[result_idx0] = bytes[input_idx0]; - } - return result; - } - // if the bytestring is more than 55 bytes long, the first byte is 183 + - // ByteLengthOfByteLength, followed by the byte length, followed by the - // bytes - else { - let len_bytes = encode_unsigned(len); - let len_bytes_length = len_bytes.length; - // total array is - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - let result = new Uint8Array(1 + len_bytes_length + len); - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - // - // ^ YOU ARE HERE - result[0] = 183 + len_bytes_length; - // copy len_bytes into result - for (let len_bytes_idx0 = 0; len_bytes_idx0 < len_bytes_length; len_bytes_idx0++) { - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - // - // ^ YOU ARE HERE - let result_idx0 = len_bytes_idx0 + 1; - result[result_idx0] = len_bytes[len_bytes_idx0]; - } - // copy original byte array into result - for (let input_idx0 = 0; input_idx0 < len; input_idx0++) { - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - // - // ^ YOU ARE HERE - let result_idx0 = input_idx0 + (1 + len_bytes_length); - result[result_idx0] = bytes[input_idx0]; - } - // finally, return the result - return result; - } -} -/** - * Encode a list - * - * @internal - */ -function encode_list(list) { - // first encode every element in the list, then branch - let payloads = list.map(encode); - let payload = uint8arr_concat(payloads); - let payload_size = payload.length; - // if the payload size is in 0..55, then the first byte is 192 + payload - // size, followed by the payload - if (payload_size <= 55) { - // result: <<(192 + Payload_Size), Payload/binary >>; - // 1 byte payload_size bytes - let result = new Uint8Array(1 + payload_size); - // result: <<(192 + Payload_Size), Payload/binary >>; - // 1 byte payload_size bytes - // - // ^ YOU ARE HERE - result[0] = 192 + payload_size; - // copy the rest of the payload into result - for (let payload_idx0 = 0; payload_idx0 < payload_size; payload_idx0++) { - // result: <<(192 + Payload_Size), Payload/binary >>; - // 1 byte payload_size bytes - // - // ^ YOU ARE HERE - let result_idx0 = payload_idx0 + 1; - result[result_idx0] = payload[payload_idx0]; - } - return result; - } - // if the payload size is greater than 55, the first byte is 247 + - // size_of_payload_size, followed by the payload size, followed by the - // payload - else { - // compute the payload size size - let payload_size_bytes = encode_unsigned(payload_size); - let payload_size_size = payload_size_bytes.length; - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - let result = new Uint8Array(1 + payload_size_size + payload_size); - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - // - // ^ YOU ARE HERE - // first byte is 247 + payload_size_size - result[0] = 247 + payload_size_size; - // copy the payload_size_bytes into result - for (let psb_idx0 = 0; psb_idx0 < payload_size_size; psb_idx0++) { - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - // - // ^ YOU ARE HERE - // offset is 1 byte for this - let result_idx0 = psb_idx0 + 1; - result[result_idx0] = payload_size_bytes[psb_idx0]; - } - // copy the payload into result - for (let pb_idx0 = 0; pb_idx0 < payload_size; pb_idx0++) { - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - // - // ^ YOU ARE HERE - // offset is 1 + payload_size_size bytes for this - let result_idx0 = pb_idx0 + (1 + payload_size_size); - result[result_idx0] = payload[pb_idx0]; - } - // finally, return result - return result; - } -} -/** - * Encode a number as a bytestring - * - * Not for general use, this assumes the input number is greater than 55 - * - * @internal - */ -function encode_unsigned(n) { - // can assume that n initially is greater than 55 - // have to encode it in reverse order - let arr = []; - // repeated division by 256 with remainder - // - // example: suppose bign was 1234 and we were dividing by 10 - // - // iteration 0: - // bign = 1234 - // arr = [] - // --- - // bign / 10 = 123 - // bign % 10 = 4 - // --- - // bign = 123 - // arr = [4] - // - // iteration 1: - // bign = 123 - // arr = [4] - // --- - // bign / 10 = 12 - // bign % 10 = 3 - // --- - // bign = 12 - // arr = [4, 3] - // - // iteration 2: - // bign = 12 - // arr = [4, 3] - // --- - // bign / 10 = 1 - // bign % 10 = 2 - // --- - // bign = 1 - // arr = [4, 3, 2] - // - // iteration 3: - // bign = 1 - // arr = [4, 3, 2] - // --- - // bign / 10 = 0 - // bign % 10 = 1 - // --- - // bign = 0 - // arr = [4, 3, 2, 1] - // - // iteration 4: - // bign = 0 - // arr = [4, 3, 2, 1] - // --- - // DONE - while (n > 0) { - arr.push(n % 256); - n >>= 8; - } - // reverse and make into Uint8Array - arr.reverse(); - return new Uint8Array(arr); -} -/** - * concatenate an array of `Uint8Array`s into a single Uint8Array - * - * @internal - */ -function uint8arr_concat(arrs) { - // total length - let total_len = arrs.reduce(// fold - function (acc_len, this_uint8array) { - return acc_len + this_uint8array.length; - }, - // initial accumulator - 0); - // start up result - let result = new Uint8Array(total_len); - let result_idx0 = 0; - // concatenate - for (let this_uint8arr of arrs) { - // bytewise copy of this uint8array - for (let this_uint8arr_idx0 = 0; this_uint8arr_idx0 < this_uint8arr.length; this_uint8arr_idx0++) { - // copy byte and increment result idx0 - result[result_idx0] = this_uint8arr[this_uint8arr_idx0]; - result_idx0++; - } - } - return result; -} -/** - * returns true if input is `instanceof Uint8Array` - * - * @internal - */ -function is_binary(x) { - return (x instanceof Uint8Array); -} -/** - * returns true if input is `instanceof Array` - * - * @internal - */ -function is_list(x) { - return (x instanceof Array); -} -//# sourceMappingURL=rlp.js.map \ No newline at end of file diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/rlp.js.map b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/rlp.js.map deleted file mode 100644 index 4bc573f..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/rlp.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"rlp.js","sourceRoot":"","sources":["../src/rlp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAGH,MAAM,EACN,MAAM,EACT,CAAA;AA4BD;;;GAGG;AACH,SACA,MAAM,CACD,KAAiB;IAGlB,uBAAuB;IACvB,IAAI,UAAU,GAAgB,KAAK,CAAC,CAAC,CAAC,CAAC;IACvC,IAAI,IAAI,GAAsB,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC7C,2DAA2D;IAC3D,IACC,UAAU,IAAI,GAAG,EAAE;QAChB,OAAO,EAAE,CAAC,IAAI,UAAU,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;KACjD;IACD,0EAA0E;IAC1E,+BAA+B;SAC1B,IACJ,UAAU,IAAI,GAAG,EAAE;QAChB,IAAI,mBAAmB,GAAgB,UAAU,GAAG,GAAG,CAAC;QACxD,IAAI,OAAO,GAA4B,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC;QAC1E,IAAI,KAAK,GAA8B,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACvE,OAAO,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;KAC7B;IACD,wEAAwE;IACxE,0EAA0E;IAC1E,sBAAsB;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OAAO,GAAG,eAAe,CAAC,MAAM,CAAC;IAC5C,CAAC;IACD,sBAAsB;IACtB,CAAC,CAAC,CAAC;IAC/B,kBAAkB;IAClB,IAAI,MAAM,GAAqB,IAAI,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,IAAI,WAAW,GAAgB,CAAC,CAAC;IACjC,cAAc;IACd,KAAK,IAAI,aAAa,IAAI,IAAI,EAAE;QAC5B,mCAAmC;QACnC,KAAK,IAAI,kBAAkB,GAAG,CAAC,EACtB,kBAAkB,GAAG,aAAa,CAAC,MAAM,EACzC,kBAAkB,EAAE,EAC7B;YACI,sCAAsC;YACtC,MAAM,CAAC,WAAW,CAAC,GAAG,aAAa,CAAC,kBAAkB,CAAC,CAAC;YACxD,WAAW,EAAE,CAAC;SACjB;KACJ;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;GAIG;AACH,SACA,SAAS,CACJ,CAAM;IAGP,OAAO,CAAC,CAAC,YAAY,UAAU,CAAC,CAAC;AACrC,CAAC;AAID;;;;GAIG;AACH,SACA,OAAO,CACF,CAAM;IAGP,OAAO,CAAC,CAAC,YAAY,KAAK,CAAC,CAAC;AAChC,CAAC"} \ No newline at end of file diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/safe.d.ts b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/safe.d.ts deleted file mode 100644 index d03574e..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/safe.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -/** - * "Safe" error handling - * - * The idea here is that there are situations where it is known - * - * ```typescript - * type Safe - * = Ok - * | Error; - * - * type Ok - * = {ok : true, - * result : ok_t}; - * - * type Error - * = {ok : false, - * error : err_t}; - * ``` - * - * 1. a given function call is likely to fail - * 2. the likely errors can be enumerated - * - * These are called "positive errors". An example would be a page script - * asking a browser wallet extension to sign a transaction. The following - * errors, among others, are likely: - * - * - the user does not have a wallet installed - * - the user has a wallet but does not have the correct signing key - * - the user rejects the transaction - * - the sign request timed out - * - * These errors should not generate exceptions, as these behaviors are to some - * degree "expected". - */ -export { Safe, Ok, Error, ok, error, unsafe }; -/** - * Type that catches positive errors - */ -declare type Safe = Ok | Error; -/** - * Ok type - */ -declare type Ok = { - ok: true; - result: ok_t; -}; -/** - * Error type - */ -declare type Error = { - ok: false; - error: err_t; -}; -/** - * Constructs an `Ok` value from a pure value - */ -declare function ok(x: ok_t): Ok; -/** - * Constructs an `Error` value from a pure value - */ -declare function error(x: err_t): Error; -/** - * Takes a `Safe` value, if `ok`, returns the `ok_t`, or if an error throws the - * `err_t` - */ -declare function unsafe(x: Safe): ok_t; diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/safe.js b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/safe.js deleted file mode 100644 index 925656b..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/safe.js +++ /dev/null @@ -1,58 +0,0 @@ -/** - * "Safe" error handling - * - * The idea here is that there are situations where it is known - * - * ```typescript - * type Safe - * = Ok - * | Error; - * - * type Ok - * = {ok : true, - * result : ok_t}; - * - * type Error - * = {ok : false, - * error : err_t}; - * ``` - * - * 1. a given function call is likely to fail - * 2. the likely errors can be enumerated - * - * These are called "positive errors". An example would be a page script - * asking a browser wallet extension to sign a transaction. The following - * errors, among others, are likely: - * - * - the user does not have a wallet installed - * - the user has a wallet but does not have the correct signing key - * - the user rejects the transaction - * - the sign request timed out - * - * These errors should not generate exceptions, as these behaviors are to some - * degree "expected". - */ -export { ok, error, unsafe }; -/** - * Constructs an `Ok` value from a pure value - */ -function ok(x) { - return { ok: true, result: x }; -} -/** - * Constructs an `Error` value from a pure value - */ -function error(x) { - return { ok: false, error: x }; -} -/** - * Takes a `Safe` value, if `ok`, returns the `ok_t`, or if an error throws the - * `err_t` - */ -function unsafe(x) { - if (x.ok) - return x.result; - else - throw x.error; -} -//# sourceMappingURL=safe.js.map \ No newline at end of file diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/safe.js.map b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/safe.js.map deleted file mode 100644 index e5e7521..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/dist/safe.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"safe.js","sourceRoot":"","sources":["../src/safe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAIH,EAAE,EACF,KAAK,EACL,MAAM,EACT,CAAA;AA2BD;;GAEG;AACH,SACA,EAAE,CAEG,CAAQ;IAGT,OAAO,EAAC,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,EAAC,CAAC;AACjC,CAAC;AAID;;GAEG;AACH,SACA,KAAK,CAEA,CAAQ;IAGT,OAAO,EAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAC,CAAC;AACjC,CAAC;AAID;;;GAGG;AACH,SACA,MAAM,CAED,CAAoB;IAGrB,IAAI,CAAC,CAAC,EAAE;QACJ,OAAO,CAAC,CAAC,MAAM,CAAC;;QAEhB,MAAM,CAAC,CAAC,KAAK,CAAC;AACtB,CAAC"} \ No newline at end of file diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/b58.ts b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/b58.ts deleted file mode 100644 index 1fd30b8..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/b58.ts +++ /dev/null @@ -1,418 +0,0 @@ -/** - * Base58 encoding/decoding - */ - -export { - encode, - decode -} - - - -//============================================================================= -// ENCODING -//============================================================================= - -/** - * Encode a Uint8Array into base58 - */ -function -encode - (binary : Uint8Array) - : string -{ - let num_leading_zeros : number = nlz(binary); - let rest : Uint8Array = binary.slice(num_leading_zeros); - let ones : string = encode_zeros(num_leading_zeros); - let rest_b58 : string = encode_rest(rest); - let result : string = ones + rest_b58; - return result; -} - - - -/** - * count the number of leading zeros in a uint8array - * - * @internal - */ -function -nlz - (bytes: Uint8Array) - : number -{ - let n = 0; - for (let this_byte of bytes) - { - if (0 === this_byte) { n++; } - else { break; } - } - return n; -} - - - -/** - * Generate a bunch of '1's for however many leading zeros there are - * - * @internal - */ -function -encode_zeros - (how_many : number) - : string -{ - let ones : string = ''; - for (let i = 1; - i <= how_many; - i++) - { - ones += '1'; - } - - return ones; -} - - - -/** - * Encode a Uint8Array that has no leading zeros - * - * @internal - */ -function -encode_rest - (bytes : Uint8Array) - : string -{ - let bytes_bignum : bigint = bytes_to_bigint(bytes); - let result : string = bignum_to_base58(bytes_bignum); - return result; -} - - - -/** - * Convert a bytestring to a bignum - * - * @internal - */ -function -bytes_to_bigint - (bytes: Uint8Array) - : bigint -{ - let acc_bigint : bigint = 0n; - for(let this_byte of bytes) - { - acc_bigint <<= 8n; - acc_bigint += BigInt(this_byte); - } - return acc_bigint; -} - - - -/** - * Convert a BigInt to Base58 - * - * @internal - */ -function -bignum_to_base58 - (q: bigint) - : string -{ - let s = ''; - while (q !== 0n) - { - let this_n : bigint = q % 58n; - q /= 58n; - - let this_b58_char : string = bigint_to_char(this_n); - s = this_b58_char + s; - } - return s; -} - - - -//============================================================================= -// DECODING -//============================================================================= - -/** - * Decode a Base58 string into a Uint8Array - */ -function -decode - (base58: string) - : Uint8Array -{ - let num_leading_ones : number = nlo(base58); - let rest : string = base58.slice(num_leading_ones); - let zeros : Array = decode_ones(num_leading_ones); - let rest_arr : Array = decode_rest(rest); - let pre_result : Array = zeros.concat(rest_arr); - return new Uint8Array(pre_result); -} - - - -/** - * count the number of leading 1 characters in a uint8array - * - * @internal - */ -function -nlo - (base58: string) - : number -{ - let n = 0; - for (let this_char of base58) - { - if ('1' === this_char) { n++; } - else { break; } - } - return n; -} - - - -/** - * Generate a bunch of '0's for however many leading ones there are - * - * @internal - */ -function -decode_ones - (how_many : number) - : Array -{ - let zeros : Array = []; - for (let i = 1; - i <= how_many; - i++) - { - zeros.push(0); - } - - return zeros; -} - - - -/** - * Decode a string that has no leading 1s - * - * @internal - */ -function -decode_rest - (base58: string) - : Array -{ - let result_bignum : bigint = base58_to_bigint(base58); - let result : Array = bigint_to_base256(result_bignum); - return result; -} - - - -/** - * Convert a base58 string to a bignum - * - * @internal - */ -function -base58_to_bigint - (base58: string) - : bigint -{ - let acc_bigint : bigint = 0n; - for(let this_char of base58) - { - acc_bigint *= 58n; - acc_bigint += char_to_bigint(this_char); - } - return acc_bigint; -} - - -/** - * convert a bignum into a byte array - * - * @end - */ -function -bigint_to_base256 - (q: bigint) - : Array -{ - let arr_reverse = []; - while(q !== 0n) - { - let r: number = Number(q % 256n); - q /= 256n; - arr_reverse.push(r); - } - arr_reverse.reverse(); - return arr_reverse; -} - - -//============================================================================= -// TRANSLATION TABLES -//============================================================================= - - -/** - * Base58 integer -> character conversion table - * - * @internal - */ -function -bigint_to_char - (n: bigint) - : string -{ - switch(n) { - case 0n: return '1'; - case 1n: return '2'; - case 2n: return '3'; - case 3n: return '4'; - case 4n: return '5'; - case 5n: return '6'; - case 6n: return '7'; - case 7n: return '8'; - case 8n: return '9'; - case 9n: return 'A'; - case 10n: return 'B'; - case 11n: return 'C'; - case 12n: return 'D'; - case 13n: return 'E'; - case 14n: return 'F'; - case 15n: return 'G'; - case 16n: return 'H'; - case 17n: return 'J'; - case 18n: return 'K'; - case 19n: return 'L'; - case 20n: return 'M'; - case 21n: return 'N'; - case 22n: return 'P'; - case 23n: return 'Q'; - case 24n: return 'R'; - case 25n: return 'S'; - case 26n: return 'T'; - case 27n: return 'U'; - case 28n: return 'V'; - case 29n: return 'W'; - case 30n: return 'X'; - case 31n: return 'Y'; - case 32n: return 'Z'; - case 33n: return 'a'; - case 34n: return 'b'; - case 35n: return 'c'; - case 36n: return 'd'; - case 37n: return 'e'; - case 38n: return 'f'; - case 39n: return 'g'; - case 40n: return 'h'; - case 41n: return 'i'; - case 42n: return 'j'; - case 43n: return 'k'; - case 44n: return 'm'; - case 45n: return 'n'; - case 46n: return 'o'; - case 47n: return 'p'; - case 48n: return 'q'; - case 49n: return 'r'; - case 50n: return 's'; - case 51n: return 't'; - case 52n: return 'u'; - case 53n: return 'v'; - case 54n: return 'w'; - case 55n: return 'x'; - case 56n: return 'y'; - case 57n: return 'z'; - default: - throw new Error('invalid base58 bigint: ' + n); - } -} - - - -/** - * Base58 character -> integer conversion table - * - * @internal - */ -function -char_to_bigint - (s: string) - : bigint -{ - switch(s) { - case '1': return 0n; - case '2': return 1n; - case '3': return 2n; - case '4': return 3n; - case '5': return 4n; - case '6': return 5n; - case '7': return 6n; - case '8': return 7n; - case '9': return 8n; - case 'A': return 9n; - case 'B': return 10n; - case 'C': return 11n; - case 'D': return 12n; - case 'E': return 13n; - case 'F': return 14n; - case 'G': return 15n; - case 'H': return 16n; - case 'J': return 17n; - case 'K': return 18n; - case 'L': return 19n; - case 'M': return 20n; - case 'N': return 21n; - case 'P': return 22n; - case 'Q': return 23n; - case 'R': return 24n; - case 'S': return 25n; - case 'T': return 26n; - case 'U': return 27n; - case 'V': return 28n; - case 'W': return 29n; - case 'X': return 30n; - case 'Y': return 31n; - case 'Z': return 32n; - case 'a': return 33n; - case 'b': return 34n; - case 'c': return 35n; - case 'd': return 36n; - case 'e': return 37n; - case 'f': return 38n; - case 'g': return 39n; - case 'h': return 40n; - case 'i': return 41n; - case 'j': return 42n; - case 'k': return 43n; - case 'm': return 44n; - case 'n': return 45n; - case 'o': return 46n; - case 'p': return 47n; - case 'q': return 48n; - case 'r': return 49n; - case 's': return 50n; - case 't': return 51n; - case 'u': return 52n; - case 'v': return 53n; - case 'w': return 54n; - case 'x': return 55n; - case 'y': return 56n; - case 'z': return 57n; - default: - throw new Error('invalid base58 char: ' + s); - } -} diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/b64.ts b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/b64.ts deleted file mode 100644 index d82cd73..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/b64.ts +++ /dev/null @@ -1,655 +0,0 @@ -/** - * Base64 Utility Functions in TypeScript - */ - -export { - encode, - decode -} - - - -/** - * Encode an array of bytes as a Uint8Array in base64 notation. - */ -function -encode - (bytes: Uint8Array) - : string -{ - // slice the array - // length of head is a multiple of 3 - // treat the tail as a special case - let {head, tail, tail_len} = slice3k(bytes); - let head_str : string = encode_head(head); - let tail_str : string = encode_tail(tail, tail_len); - return head_str + tail_str; -} - - - -type slice3k - = {head : Uint8Array, - tail : Uint8Array, - tail_len : number}; - -/** - * Take a Uint8Array, take the first 3k (k >= 0) bytes, put them in head, and - * the remaining 0,1, or 2 bytes, put them in tail - * - * @internal - */ -function -slice3k - (bytes: Uint8Array) - : slice3k -{ - let len : number = bytes.length; - // too lazy to look up how to do integer division in js so this will do - let tail_len : number = len % 3; - let head_len : number = len - tail_len; - // for slice: - // first argument is the 0-index of the start - // second - first is the length of the slice - let head : Uint8Array = bytes.slice(0, head_len); - // empty second argument means go to the end - let tail : Uint8Array = bytes.slice(head_len); - return {head : head, - tail : tail, - tail_len : tail_len}; -} - - - -/** - * Encode a Uint8Array whose length is known to be a multiple of 3 - * - * @internal - */ -function -encode_head - (head_bytes: Uint8Array) - : string -{ - // can assume length of bytes is a multiple of 3 - // start index at 0 - // increment by 3 - let head_bytes_len : number = head_bytes.length; - let max_idx0 : number = head_bytes_len - 1; - - let head_str_acc : string = ''; - for(let this_3slice_start_idx0 = 0; - this_3slice_start_idx0 <= max_idx0; - this_3slice_start_idx0 += 3) - { - let this_3slice_bytes : Uint8Array = head_bytes.slice(this_3slice_start_idx0, this_3slice_start_idx0 + 3); - let this_3slice_str : string = encode3(this_3slice_bytes); - head_str_acc += this_3slice_str; - } - - return head_str_acc; -} - - - -/** - * Encode a 3 bytes into base64 notation - * - * @internal - */ -function -encode3 - (bytes: Uint8Array) - : string -{ - let b0 : number = bytes[0]; - let b1 : number = bytes[1]; - let b2 : number = bytes[2]; - - // ABCDEFGH 12345678 abcdefgh - // b0 b1 b2 - // ABCDEF GH1234 5678ab cdefgh - // n0 n1 n2 n3 - let n0 : number = b0 >> 2; - // b0 = ABCDEFGH - // 4 = _____1__ - // b0 % 4 = ______GH - // (b0 % 4) << 4 = __GH____ - // b1 = 12345678 - // b1 >> 4 = ____1234 - // n1 = __GH1234 - let n1 : number = ((b0 % 4) << 4) + (b1 >> 4); - // b1 = 12345678 - // 16 = ___1____ - // b1 % 16 = ____5678 - // (b1 % 16) << 2 = __5678__ - // b2 = abcdefgh - // b2 >> 6 = ______ab - // n2 = __5678ab - let n2 : number = ((b1 % 16) << 2) + (b2 >> 6); - // b2 = abcdefgh - // 64 = _1______ - // n3 = __cdefgh - let n3 : number = b2 % 64; - - // convert to chars - let s0 : string = int2char(n0); - let s1 : string = int2char(n1); - let s2 : string = int2char(n2); - let s3 : string = int2char(n3); - - // retrvn - return s0 + s1 + s2 + s3; -} - - - -/** - * Encode the final 0, 1, or 2 bytes - * - * @internal - */ -function -encode_tail - (tail_bytes : Uint8Array, - tail_len : number) - : string -{ - switch(tail_len) { - case 0: return ''; - case 1: return encode1(tail_bytes); - case 2: return encode2(tail_bytes); - default: - throw new Error('encode_tail with tail_len = ' + tail_len); - } -} - - - -/** - * Encode a single byte - * - * @internal - */ -function -encode1 - (bytes: Uint8Array) - : string -{ - let b0 : number = bytes[0]; - // n0 = __ABCDEF - // b0 = ABCDEFGH - // b0 >> 2 = __ABCDEF - let n0 : number = b0 >> 2; - // n1 = __GH____ - // b0 = ABCDEFGH - // 4 = _____1__ - // b0 % 4 = ______GH - // (b0 % 4) << 4 = __GH____ - let n1 : number = (b0 % 4) << 4; - - return int2char(n0) + int2char(n1) + '=='; -} - - - -/** - * Encode two bytes - * - * @internal - */ -function -encode2 - (bytes: Uint8Array) - : string -{ - let b0 : number = bytes[0]; - let b1 : number = bytes[1]; - - // ABCDEFGH 12345678 - // b0 b1 - // ABCDEF GH1234 5678__ - // n0 n1 n2 - let n0 : number = b0 >> 2; - // b0 = ABCDEFGH - // 4 = _____1__ - // b0 % 4 = ______GH - // (b0 % 4) << 4 = __GH____ - // b1 = 12345678 - // b1 >> 4 = ____1234 - // n1 = __GH1234 - let n1 : number = ((b0 % 4) << 4) + (b1 >> 4); - // b1 = 12345678 - // 16 = ___1____ - // b1 % 16 = ____5678 - // (b1 % 16) << 2 = __5678__ - // n2 = __5678__ - let n2 : number = (b1 % 16) << 2; - - // convert to chars - let s0 : string = int2char(n0); - let s1 : string = int2char(n1); - let s2 : string = int2char(n2); - - // retrvn - return s0 + s1 + s2 + '='; -} - - - -/** - * Decode a base64-encoded string - */ -function -decode - (base64_str : string) - : Uint8Array -{ - // length of the string is guaranteed to be a multiple of 4 - // if the string is empty, return the empty array - let len = base64_str.length; - // this branching contains the implicit assertion that the length is a - // multiple of 4. If this is not true, the bottom branch is triggered. - // general case goes first because speeeeeed - if ( (4 < len) - && (0 === (len % 4))) - { - // split the head and tail - let tail_start_idx0 : number = len - 4; - let head_s : string = base64_str.slice(0, tail_start_idx0); - let tail_s : string = base64_str.slice(tail_start_idx0); - // Using arrays because Uint8Arrays don't have a concat operation - let head_arr : Array = decode_head(head_s); - let tail_arr : Array = decode_tail(tail_s); - // silly to put these in variables but this is exactly the type of - // situation where JS type insanity shows up - // - // see: i forgot - // > [1,2,3] + [4,5,6] - // '1,2,34,5,6' - // - // Originally, I used + like some sort of moron who codes in a sane - // language - // - // seriously what is this language - // - // this is some clown behavior - let total_arr : Array = head_arr.concat(tail_arr); - return new Uint8Array(total_arr); - } - // special case if the length is exactly 4 - else if (4 === len) - { - // it's just a tail - return new Uint8Array(decode_tail(base64_str)); - } - // empty string - else if (0 === len) - { - return new Uint8Array([]); - } - else - { - throw new Error('base64 decode: invalid string length: ' + len); - } -} - - - -/** - * Decode a string known to not have any padding - * - * @internal - */ -function -decode_head - (s: string) - : Array -{ - // go 4 characters at a time - let max_i0 : number = s.length - 1; - let decoded_acc : Array = []; - for(let i0 = 0; - i0 <= max_i0; - i0 += 4) - { - let this_slice_s : string = s.slice(i0, i0 + 4); - let this_slice_arr : Array = decode3(this_slice_s); - // update accumulator - decoded_acc = decoded_acc.concat(this_slice_arr); - } - return decoded_acc; -} - - - -/** - * Decode 4 characters that correspond to either 3 bytes, 2, bytes, or 1 byte - * - * @internal - */ -function -decode_tail - (s: string) - : Array -{ - // all that matters right now is the last 2 chars - // s0, s1, s2, s3 - // 0 based indexing is so annoying - let s2 = s[2]; - let s3 = s[3]; - - // braaaaaaaaaaaaaaaaaench - // two equals signs means 1 byte - if (('=' === s3) && ('=' === s2)) { - return decode1(s); - } - // one equals sign means 2 bytes - else if (('=' === s3)) { - return decode2(s); - } - // 0 equals signs means 3 bytes - else { - return decode3(s); - } -} - - - -/** - * Decode a 4-character long base64 string corresponding to 3 bytes - * - * @internal - */ -function -decode3 - (s: string) - : Array -{ - // pull out strings - let s0 : string = s[0]; - let s1 : string = s[1]; - let s2 : string = s[2]; - let s3 : string = s[3]; - - // convert to numbers - let n0 : number = char2int(s0); - let n1 : number = char2int(s1); - let n2 : number = char2int(s2); - let n3 : number = char2int(s3); - - // abcdef gh1234 5678ab cdefgh - // n0 n1 n2 n3 - // abcdefgh 12345678 abcdefgh - // b0 b1 b2 - - // n0 = __abcdef - // n1 = __gh1234 - // n0 << 2 = abcdef__ - // n1 >> 4 = ______gh - // b0 = abcdefgh - let b0 : number = (n0 << 2) + (n1 >> 4); - // n1 = __gh1234 - // 16 = ___1____ - // n1 % 16 = ____1234 - // (n1 % 16) << 4 = 1234____ - // n2 = __5678ab - // n2 >> 2 = ____5678 - // b1 = 12345678 - let b1 : number = ((n1 % 16) << 4) + (n2 >> 2); - // n2 = __5678ab - // 4 = _____1__ - // n2 % 4 = ______ab - // (n2 % 4) << 6 = ab______ - // n3 = __cdefgh - let b2 : number = ((n2 % 4) << 6) + n3; - - return [b0, b1, b2]; -} - - - -/** - * Decode a 4-character long base64 string corresponding to 2 bytes - * - * @internal - */ -function -decode2 - (s: string) - : Array -{ - // xyz= - // pull out strings - let s0 : string = s[0]; - let s1 : string = s[1]; - let s2 : string = s[2]; - - // convert to numbers - let n0 : number = char2int(s0); - let n1 : number = char2int(s1); - let n2 : number = char2int(s2); - - // abcdef gh1234 5678__ - // n0 n1 n2 - // abcdefgh 12345678 - // b0 b1 - - // n0 = __abcdef - // n1 = __gh1234 - // n0 << 2 = abcdef__ - // n1 >> 4 = ______gh - // b0 = abcdefgh - let b0 : number = (n0 << 2) + (n1 >> 4); - // n1 = __gh1234 - // 16 = ___1____ - // n1 % 16 = ____1234 - // (n1 % 16) << 4 = 1234____ - // n2 = __5678__ - // n2 >> 2 = ____5678 - // b1 = 12345678 - let b1 : number = ((n1 % 16) << 4) + (n2 >> 2); - - return [b0, b1]; -} - - - -/** - * Decode a 4-character long base64 string corresponding to 2 bytes - * - * @internal - */ -function -decode1 - (s: string) - : Array -{ - // xy== - // pull out strings - let s0 : string = s[0]; - let s1 : string = s[1]; - - // convert to numbers - let n0 : number = char2int(s0); - let n1 : number = char2int(s1); - - // abcdef gh____ - // n0 n1 - // abcdefgh - // b0 - - // n0 = __abcdef - // n1 = __gh____ - // n0 << 2 = abcdef__ - // n1 >> 4 = ______gh - // b0 = abcdefgh - let b0 : number = (n0 << 2) + (n1 >> 4); - - return [b0]; -} - - - - -// FIXME: these tables would *probably* be faster if they were made into objects - -/** - * Conversion table for base64 encode - * - * @internal - */ -function -int2char - (n: number) - : string -{ - switch(n) { - case 0: return 'A'; - case 1: return 'B'; - case 2: return 'C'; - case 3: return 'D'; - case 4: return 'E'; - case 5: return 'F'; - case 6: return 'G'; - case 7: return 'H'; - case 8: return 'I'; - case 9: return 'J'; - case 10: return 'K'; - case 11: return 'L'; - case 12: return 'M'; - case 13: return 'N'; - case 14: return 'O'; - case 15: return 'P'; - case 16: return 'Q'; - case 17: return 'R'; - case 18: return 'S'; - case 19: return 'T'; - case 20: return 'U'; - case 21: return 'V'; - case 22: return 'W'; - case 23: return 'X'; - case 24: return 'Y'; - case 25: return 'Z'; - case 26: return 'a'; - case 27: return 'b'; - case 28: return 'c'; - case 29: return 'd'; - case 30: return 'e'; - case 31: return 'f'; - case 32: return 'g'; - case 33: return 'h'; - case 34: return 'i'; - case 35: return 'j'; - case 36: return 'k'; - case 37: return 'l'; - case 38: return 'm'; - case 39: return 'n'; - case 40: return 'o'; - case 41: return 'p'; - case 42: return 'q'; - case 43: return 'r'; - case 44: return 's'; - case 45: return 't'; - case 46: return 'u'; - case 47: return 'v'; - case 48: return 'w'; - case 49: return 'x'; - case 50: return 'y'; - case 51: return 'z'; - case 52: return '0'; - case 53: return '1'; - case 54: return '2'; - case 55: return '3'; - case 56: return '4'; - case 57: return '5'; - case 58: return '6'; - case 59: return '7'; - case 60: return '8'; - case 61: return '9'; - case 62: return '+'; - case 63: return '/'; - default: throw new Error("invalid base64 encode byte: " + n); - } -} - - - -/** - * Conversion table for base64 decode - * - * @internal - */ -function -char2int - (s: string) - : number -{ - switch(s) { - case 'A': return 0; - case 'B': return 1; - case 'C': return 2; - case 'D': return 3; - case 'E': return 4; - case 'F': return 5; - case 'G': return 6; - case 'H': return 7; - case 'I': return 8; - case 'J': return 9; - case 'K': return 10; - case 'L': return 11; - case 'M': return 12; - case 'N': return 13; - case 'O': return 14; - case 'P': return 15; - case 'Q': return 16; - case 'R': return 17; - case 'S': return 18; - case 'T': return 19; - case 'U': return 20; - case 'V': return 21; - case 'W': return 22; - case 'X': return 23; - case 'Y': return 24; - case 'Z': return 25; - case 'a': return 26; - case 'b': return 27; - case 'c': return 28; - case 'd': return 29; - case 'e': return 30; - case 'f': return 31; - case 'g': return 32; - case 'h': return 33; - case 'i': return 34; - case 'j': return 35; - case 'k': return 36; - case 'l': return 37; - case 'm': return 38; - case 'n': return 39; - case 'o': return 40; - case 'p': return 41; - case 'q': return 42; - case 'r': return 43; - case 's': return 44; - case 't': return 45; - case 'u': return 46; - case 'v': return 47; - case 'w': return 48; - case 'x': return 49; - case 'y': return 50; - case 'z': return 51; - case '0': return 52; - case '1': return 53; - case '2': return 54; - case '3': return 55; - case '4': return 56; - case '5': return 57; - case '6': return 58; - case '7': return 59; - case '8': return 60; - case '9': return 61; - case '+': return 62; - case '/': return 63; - default: throw new Error("invalid base64 character: " + s); - } -} diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/bin.ts b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/bin.ts deleted file mode 100644 index 958aa2a..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/bin.ts +++ /dev/null @@ -1,377 +0,0 @@ -/** - * Miscellaneous binary utility functions - * - * @module - */ - -export { - bytes_to_bigint, - bigint_to_bytes, - concat, - strong_rand_bytes -}; - - - -/** - * Concatenate two arrays - */ -function -concat - (arr1 : Uint8Array, - arr2 : Uint8Array) - : Uint8Array -{ - let len1 : number = arr1.length; - let len2 : number = arr2.length; - let arr1_idx0_offset : number = 0; - let arr2_idx0_offset : number = len1; - let result_len : number = len1 + len2; - let result : Uint8Array = new Uint8Array(result_len); - // copy first array into result - for (let arr1_idx0 = 0; - arr1_idx0 < len1; - arr1_idx0++) - { - // no offset here - let result_idx0 : number = arr1_idx0 + arr1_idx0_offset; - result[result_idx0] = arr1[arr1_idx0]; - } - // copy second array into result - for (let arr2_idx0 = 0; - arr2_idx0 < len2; - arr2_idx0++) - { - // offset by the length of the first array - let result_idx0 : number = arr2_idx0 + arr2_idx0_offset; - result[result_idx0] = arr2[arr2_idx0]; - } - return result; -} - - - -/** - * Cryptographically random bytes - */ -function -strong_rand_bytes - (how_many : number) - : Uint8Array -{ - let arr = new Uint8Array(how_many); - (new Crypto()).getRandomValues(arr); - return arr; -} - - - -/** - * Convert a byte array to a bigint - * - * Equivalent to `binary:decode_unsigned/1` from Erlang - */ -function -bytes_to_bigint - (bytes: Uint8Array) - : bigint -{ - let n : bigint = 0n; - for (let b of bytes) { - // move first, then add - // otherwise it ends on a move - // imperative languages are for losers - n <<= 8n; - n += BigInt(b); - } - return n; -} - - - -/** - * Convert a bigint to a byte array - * - * Equivalent to `binary:encode_unsigned/1` from Erlang - * - * Requires input to be positive - */ -function -bigint_to_bytes - (q: bigint) - : Uint8Array -{ - if (q < 0n) { - throw new Error('q < 0n: ' + q); - } - - let arr_reverse = []; - while (q > 0n) { - let r = Number(q % 256n); - q /= 256n; - arr_reverse.push(r); - } - arr_reverse.reverse(); - return new Uint8Array(arr_reverse); -} - - - -/** - * Oh no, bitstrings in a language that only has bytestrings - * - * By convention these are `Uint8Array`s with byte length `ceil(bit_length / - * 8)`, and all trailing bits are zero. - */ -type bits = - {bit_length : number, - bytes : Uint8Array}; - - - -/** - * Get an uninitialized bitstring - * - * @internal - */ -function -bits_null - (bit_length : number) - : bits -{ - let byte_length : number = Math.ceil(bit_length / 8); - let result : Uint8Array = new Uint8Array(byte_length); - return {bit_length : bit_length, - bytes : result}; -} - - - -/** - * Get a bitstring of a given length where every value is 0. - */ -function -bits_zeros - (bit_length : number) - : bits -{ - let byte_length : number = Math.ceil(bit_length / 8); - let result : Uint8Array = new Uint8Array(byte_length); - for (let i0 = 0; - i0 < byte_length; - i0++) - { - result[i0] = 0; - } - return {bit_length : bit_length, - bytes : result}; -} - - - -/** - * Get a bitstring of a given length where every value is 1. - */ -function -bits_ones - (bit_length : number) - : bits -{ - let byte_length : number = Math.ceil(bit_length / 8); - let result : Uint8Array = new Uint8Array(byte_length); - - // fill everything except the last byte with 255s - for (let i0 = 0; - i0 < (byte_length - 1); - i0++) - { - result[i0] = 255; - } - - // alright so the last byte - // ok so the number of leading 0s is - // 8 - (bit_length % 8) - let num_trailing_zero_bits : number = 8 - (bit_length % 8); - // the trailing byte is 255 << that - // e.g. 3 trailing 0s - // 1111_1111 -> 1111_1000 - let last_byte : number = 255 << num_trailing_zero_bits; - let last_byte_idx0 : number = byte_length - 1; - result[last_byte_idx0] = last_byte; - - return {bit_length : bit_length, - bytes : result}; -} - - - -/** - * Get the bit at a given 0-index - */ -function -bits_i0th - (bit_idx0 : number, - bits : bits) - : number -{ - // first task is figuring out what byte we're at - // for instance if we want bit 27 - // 3*8 = 24 =< 27 < 4*8 - // so it's Math.floor(bit_idx0 / 8) - let byte_idx0 : number = Math.floor(bit_idx0 / 8); - // let's fetch the byte and work with that - let the_byte : number = bits.bytes[byte_idx0]; - - // ok so let's go with 27 again - // 27 = 3 mod 8 - // so we bitshift right by (8 - 3) - // and then take the remainder dividing by 2 - // --B-_---- -> ----_---B -> 0000_000B - let bsr : number = 8 - (bit_idx0 % 8); - return (the_byte >> bsr) % 2; -} - - - -/** - * Concatenate two bitstrings - */ -function -bits_concat - (bits1 : bits, - bits2 : bits) - : bits -{ - let result_bit_length : number = bits1.bit_length + bits2.bit_length; - let bytes1 : Uint8Array = bits1.bytes; - let bytes2 : Uint8Array = bits2.bytes; - // using zeros here because of our xor trick in a minute - let result_bits : bits = bits_null(result_bit_length); - let result_bytes : Uint8Array = result_bits.bytes; - - // go along each byte in result, and compute the byte boundary - for (let i = 0; - i < result_bytes.length; - i++) - { - // ABCD_EFGH _ - // 0123_4567 8 - // this is the bit index of the leftmost bit in this byte - let start_bit_bi0 : number = i * 8; - let next_start_bit_bi0 : number = start_bit_bi0 + 8; - // does the bit at the beginning of this byte correspond to the first array? - // strict comparison: - // suppose i = 0, - // suppose bit_length1 is 0 - // then this says no, go to second array - // suppose bl1 = 1, - // this says start at first array - let start_bit_is_of_first_array : boolean = start_bit_bi0 < bits1.bit_length; - // weak comparison: - // suppose bit_length1 = 8 - // ABCD_EFGH _ - // 0123_4567 8 - // ^ - // start_bit_bi0 ^ next_start_bit_bi0 - let stop_bit_is_of_first_array : boolean = next_start_bit_bi0 <= bits1.bit_length; - // is this a bytes1 byte - let is_bytes1_byte : boolean = start_bit_is_of_first_array && stop_bit_is_of_first_array; - let is_boundary_byte : boolean = start_bit_is_of_first_array && !stop_bit_is_of_first_array; - - // need to work out the ping_pong bs up here because js is dumb and I - // can't put lets between elseifs - // alright, now we're in the case of only copying from the second array - // we have two cases: - // ping-pong: - // ABCD_EFGH 1234_5678 - // - ---- --- - // copying these bits - // ping: - // ABCD_EFGH - // - ---- 000 - // - // how to distinguish between these two?? - // - // we're in the ping case when the start_bit_bi0 corresponds to the - // final byte of the second array - // - // ok - // - // we need to compute the bit address in the second array that - // corresponds to the bit address at the beginning of this byte in the - // result array - let bits2_addr_bi0 : number = start_bit_bi0 - bits1.bit_length; - // I think the variable is - // bits_left_to_copy = bits2.bit_length - bit_addr2_bi0 - // no + 1 because the current bit is uncopied, - // so if bit_addr2_bi0 = 7 and bits2.bit_length is 8, it means we - // have the last bit to copy - // cases: - // bits_left_to_copy <= 0 -> - // this would mean we have more bits to copy, but are out of - // source bits. should be impossible if bits_null is correct - // bits_left_to_copy <= 8 -> - // this would mean we are going to fill this last byte in the - // result array with the correct bits from array2, but how we - // do this will depend on how those are arranged in bytes2 - // (whether we grab one or two bytes) - // - // this is the tricky case - // - // I think what matters here is the byte address in the second array - // if we're on the last byte - // 8 < bits_left_to_copy -> - // this means we can safely grab two bytes from bytes2, and do - // our bitshifting to make it correct - // - // FIXME - let bits_left_to_copy : number = bits2.bit_length - bits2_addr_bi0; - // no the variable that matters is which byte we're on in the result - let this_bytes2_addr_i0 : number = Math.floor(bits2_addr_bi0 / 8); - let next_bytes2_addr_i0 : number = this_bytes2_addr_i0 + 1; - let bitshift_amt : number = bits1.bit_length % 8; - - let ping : boolean = next_bytes2_addr_i0 === bytes2.length; - - - // simple case: this is a byte from the first array - // just copy it - if (is_bytes1_byte) - result_bytes[i] = bytes1[i]; - // this is a boundary byte - // further cases: - // second bit length is 0 -> - // ABCD_EF-- - // ^ starting here - // just copy first byte and move along - else if (is_boundary_byte && (bits2.bit_length === 0)) - result_bytes[i] = bytes1[i]; - // boundary byte, and there is at least one byte in the second array - else if (is_boundary_byte) - { - // copy over the first byte - result_bytes[i] = bytes1[i]; - // take the first byte from the second array - let first_byte_of_second_array : number = bytes2[0]; - // bytes1: - // ABCD_EF00 - // 6 - // bytes2: - // 1234_5678 - // 0000_0012 - // and bitshift it right by that amount - let bitshift_amt : number = bits1.bit_length % 8; - result_bytes[i] ^= first_byte_of_second_array >> bitshift_amt; - } - // last byte of second array - else if (ping) - result_bytes[i] = (bytes2[this_bytes2_addr_i0] << bitshift_amt); - // ping-pong: not last byte of second array - else - result_bytes[i] = (bytes2[this_bytes2_addr_i0] << bitshift_amt) ^ (bytes2[next_bytes2_addr_i0] << bitshift_amt); - } - - return {bit_length : result_bit_length, - bytes : result_bytes}; - -} diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/faert.ts b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/faert.ts deleted file mode 100644 index 16c4c43..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/faert.ts +++ /dev/null @@ -1,399 +0,0 @@ -/** - * FÆRT: Fast Æternity Recovery Text - * - * Reference: https://gitlab.com/zxq9/passgas/-/blob/83607fedb08be5dfd03210e331f9c76125bb3467/fullofbeans - * - * @module - */ - -export { - encode, - decode, - byte_of_word, - check_word, - check_byte, - words -} - -import * as safe from './safe.js'; - - - -/** - * Encode a bytestring into FÆRT - */ -function -encode - (bytes : Uint8Array) - : string -{ - // initial accumulator - let words_acc : Array = []; - - // go along each byte and look up the word - // add it to the accumulator - for (let this_byte of bytes) - { - let this_word = words[this_byte]; - words_acc.push(this_word); - } - - // prepend check word to phrase - // yes craig it would be faster to do the check byte inline - // the usage case here is 64 byte strings - // double pass is not a big deal - return check_word(bytes) + ' ' + words_acc.join(' '); -} - - - -/** - * Decode a FAERT string into bytes - */ -function -decode - (faert : string) - : safe.Safe -{ - let all_words : Array = faert.split(' '); - let input_check_word : string = all_words[0]; - let input_words : Array = all_words.slice(1) - - // accumulator - let computed_bytes : Array = []; - - // loop over words and figure out accumulator - for (let this_input_word of input_words) - { - let maybe_this_byte : safe.Safe = byte_of_word(this_input_word); - // if the word is an allowable word, add it to the accumulator - if (maybe_this_byte.ok) - { - let this_byte : number = maybe_this_byte.result; - computed_bytes.push(this_byte); - } - // error case, propagate the error up the call chain - else - return maybe_this_byte; - } - - // at this point, we can assume we correctly decoded all words - // compute the check byte - let computed_bytes_u8s : Uint8Array = new Uint8Array(computed_bytes); - let computed_check_word : string = check_word(computed_bytes_u8s); - - // check if it is correct - // if so, return the computed bytes - if (computed_check_word === input_check_word) - return safe.ok(computed_bytes_u8s); - // otherwise, return an error - else - return safe.error('checksum failure! computed check word: ' + computed_check_word + '; input check word: ' + input_check_word); -} - - - -/** - * given a word, find its index - */ -function -byte_of_word - (word: string) - : safe.Safe -{ - for (let i=0; i<=255; i++) - { - if (word === words[i]) - return safe.ok(i); - } - return safe.error('invalid word: ' + word); -} - - - -/** - * compute the check word of an array - */ -function -check_word - (bytes: Uint8Array) - : string -{ - return words[check_byte(bytes)]; -} - - -/** - * given an array, compute the xor of all the bytes in the array - */ -function -check_byte - (bytes: Uint8Array) - : number -{ - let check_byte = 0; - for (let this_byte of bytes) - check_byte ^= this_byte; - return check_byte; -} - - - -let words = [ - "able", - "abuse", - "acquire", - "adjust", - "agent", - "air", - "alert", - "alpha", - "anger", - "answer", - "any", - "argue", - "around", - "assume", - "asthma", - "aunt", - "awkward", - "balcony", - "barrel", - "because", - "behave", - "bicycle", - "bike", - "blind", - "blouse", - "bonus", - "bottom", - "breeze", - "brother", - "bubble", - "burger", - "butter", - "can", - "cannon", - "cargo", - "catalog", - "caught", - "century", - "chaos", - "chicken", - "churn", - "cinnamon", - "clever", - "clock", - "clown", - "collect", - "conduct", - "convince", - "correct", - "cradle", - "crane", - "crime", - "cross", - "crystal", - "curve", - "daughter", - "debris", - "decrease", - "deny", - "deputy", - "despair", - "diesel", - "dinner", - "distance", - "document", - "donate", - "drama", - "drink", - "dutch", - "earth", - "educate", - "elbow", - "employ", - "endless", - "enlist", - "enter", - "equal", - "eternal", - "example", - "exhibit", - "exotic", - "faculty", - "famous", - "fault", - "feature", - "fiber", - "filter", - "firm", - "flame", - "flush", - "follow", - "forward", - "frame", - "fringe", - "future", - "game", - "gate", - "gift", - "glare", - "glow", - "goat", - "grab", - "grief", - "guilt", - "hand", - "hawk", - "health", - "hen", - "hire", - "honey", - "hover", - "hurry", - "hybrid", - "impose", - "inch", - "inherit", - "injury", - "install", - "iron", - "jazz", - "joke", - "just", - "kit", - "kitchen", - "language", - "laundry", - "leader", - "lend", - "leopard", - "license", - "live", - "lobster", - "lounge", - "magnet", - "mail", - "mansion", - "mass", - "math", - "media", - "message", - "metal", - "misery", - "mix", - "more", - "mountain", - "museum", - "mutual", - "narrow", - "nerve", - "next", - "note", - "obey", - "obtain", - "offer", - "once", - "orange", - "ostrich", - "over", - "owner", - "palace", - "patch", - "pave", - "pen", - "phrase", - "piece", - "pizza", - "plunge", - "polar", - "pool", - "power", - "pretty", - "private", - "protect", - "pulp", - "purity", - "quit", - "quote", - "raise", - "razor", - "recall", - "region", - "relief", - "rent", - "rescue", - "review", - "ride", - "risk", - "roof", - "rough", - "saddle", - "salmon", - "sand", - "scene", - "scrub", - "season", - "seek", - "series", - "shed", - "shoe", - "sick", - "silent", - "situate", - "skill", - "slide", - "slush", - "snack", - "solar", - "soul", - "special", - "sphere", - "spot", - "spy", - "stairs", - "stereo", - "strategy", - "stuff", - "success", - "sunny", - "surge", - "swear", - "symptom", - "tail", - "ten", - "tent", - "theme", - "thumb", - "tiny", - "toe", - "tooth", - "topic", - "trade", - "trash", - "trophy", - "truly", - "tumble", - "typical", - "uncle", - "unfair", - "until", - "upper", - "useless", - "van", - "venue", - "video", - "visa", - "vocal", - "walk", - "waste", - "wedding", - "weekend", - "wide", - "winner", - "wise", - "wood", - "wrist", - "zero" -] diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/rlp.ts b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/rlp.ts deleted file mode 100644 index 8c48b75..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/rlp.ts +++ /dev/null @@ -1,521 +0,0 @@ -/** - * Ethereum Recursive-Length Prefix Encoding implementation - * - * Two reference implementations: - * - * 1. Ethereum Python implementation - * 2. My Erlang implementation (agrees with Ethereum Python in randomized - * tests) - * - * This work can be found in ../test/testgen/ - * - * FIXME: need to have Safe assertions for "i am decoding a list", "i am - * decoding a binary", "I am decoding something with no remainder", etc - * - * @module - */ - -export { - decoded_data, - decode_result, - decode, - encode -} - - -//============================================================================= -//============================================================================= -// DECODING -//============================================================================= -//============================================================================= - - -/** - * Data that RLP can encode. Also the result of decoding. - */ -type decoded_data - = Uint8Array - | Array; - - - -/** - * Decoding can have a remainder - */ -type decode_result - = {decoded_data : decoded_data, - remainder : Uint8Array}; - - - -/** - * Decode an RLP-encoded bytestring into a `decode_result` (decoded data + - * whatever wasn't consumed) - */ -function -decode - (bytes: Uint8Array) - : decode_result -{ - // check the first byte - let first_byte: number = bytes[0]; - let rest : Uint8Array = bytes.slice(1); - // if the first byte is between 0 and 127, that is the data - if - (first_byte <= 127) { - return dr(new Uint8Array([first_byte]), rest); - } - // if the first byte is between 128 and 183 = 128 + 55, it is a bytestring - // and the length is Byte - 128 - else if - (first_byte <= 183) { - let payload_byte_length : number = first_byte - 128; - let payload : Uint8Array = rest.slice(0, payload_byte_length); - let rest2 : Uint8Array = rest.slice(payload_byte_length); - return dr(payload, rest2); - } - // if the first byte is between 184 = 183 + 1 and 191 = 183 + 8, it is a - // bytestring. the byte length of bytestring is FirstByte - 183. Then pull - // out the actual data - else if - (first_byte <= 191) { - let byte_length_of_byte_length : number = first_byte - 183; - let bytes_of_byte_length : Uint8Array = rest.slice(0, byte_length_of_byte_length); - let byte_length : number = bytes_to_number(bytes_of_byte_length); - let bytes : Uint8Array = rest.slice(byte_length_of_byte_length, - byte_length + byte_length_of_byte_length); - let rest2 : Uint8Array = rest.slice(byte_length + byte_length_of_byte_length); - return dr(bytes, rest2); - } - // If the first byte is between 192 and 247 = 192 + 55, it is a list. The - // byte length of the list-payload is FirstByte - 192. Then the list - // payload, which needs to be decoded on its own. - else if - (first_byte <= 247) { - let byte_length_of_list : number = first_byte - 192; - let list_payload : Uint8Array = rest.slice(0, byte_length_of_list); - let list : Array = decode_list(list_payload); - let rest2 : Uint8Array = rest.slice(byte_length_of_list); - return dr(list, rest2); - } - // If the first byte is between 248 = 247 + 1 and 255 = 247 + 8, it is a - // list. The byte length of the byte length of the list-payload is - // FirstByte - 247. Then the byte length of the list. Then the list - // payload, which needs to be decoded on its own. - else { - let byte_length_of_byte_length : number = first_byte - 247; - let bytes_of_byte_length : Uint8Array = rest.slice(0, byte_length_of_byte_length); - let byte_length : number = bytes_to_number(bytes_of_byte_length); - let list_bytes : Uint8Array = rest.slice(byte_length_of_byte_length, - byte_length + byte_length_of_byte_length); - let list : Array = decode_list(list_bytes); - let rest2 : Uint8Array = rest.slice(byte_length + byte_length_of_byte_length); - return dr(list, rest2); - } -} - - - -/** - * Decode a list payload (non-prefixed) into an `Array`. - * - * Repeatedly decodes an element off the list until remainder is empty. - * - * @internal - */ -function -decode_list - (bytes: Uint8Array) - : Array -{ - let arr : Array = []; - while (bytes.length > 0) { - // grab an item off the bytes - let {decoded_data, remainder} = decode(bytes); - // push it - arr.push(decoded_data); - // update bytes - bytes = remainder; - } - return arr; -} - - - -/** - * Convert bytestring to number - * - * @internal - */ -function -bytes_to_number - (bytes: Uint8Array) - : number -{ - let n : number = 0; - for (let b of bytes) - { - n <<= 8; - n += b; - } - return n; -} - - - -/** - * Make a `decode_result` containing the two arguments - * - * @internal - */ -function -dr - (x : decoded_data, - y : Uint8Array) - : decode_result -{ - return {decoded_data : x, - remainder : y}; -} - - - -//============================================================================= -//============================================================================= -// ENCODING -//============================================================================= -//============================================================================= - -/** - * Encode some decoded data - */ -function -encode - (data: decoded_data) - : Uint8Array -{ - // is it an array or data - if - (is_binary(data)) { - return encode_binary(data as Uint8Array); - } - else if - (is_list(data)) { - return encode_list(data as Array); - } - else { - throw new Error('encode told to encode something that is not an array or a binary: ' + data); - } -} - - - -/** - * Encode a binary into RLP - * - * @internal - */ -function -encode_binary - (bytes: Uint8Array) - : Uint8Array -{ - let len: number = bytes.length; - // single byte case when the byte is between 0..127 - // result is the bytestring containing the byte itself - if - ((len === 1) && - (bytes[0] <= 127)){ - return bytes; - } - // if the bytestring is 0..55 bytes long, the first byte in the result is - // 128 + Length, the rest of the result bytestring is the input string - else if - (len <= 55) { - // construct the result - // <<128 + Len, Bytes/binary>> - let result : Uint8Array = new Uint8Array(len + 1); - // first byte is 128 + length - result[0] = 128 + len; - // copy input bytes into result - for (let input_idx0 = 0; - input_idx0 < len; - input_idx0++) - { - let result_idx0 : number = input_idx0 + 1; - result[result_idx0] = bytes[input_idx0]; - } - return result; - } - // if the bytestring is more than 55 bytes long, the first byte is 183 + - // ByteLengthOfByteLength, followed by the byte length, followed by the - // bytes - else { - let len_bytes : Uint8Array = encode_unsigned(len); - let len_bytes_length : number = len_bytes.length; - // total array is - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - let result : Uint8Array = new Uint8Array(1 + len_bytes_length + len); - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - // - // ^ YOU ARE HERE - result[0] = 183 + len_bytes_length; - // copy len_bytes into result - for (let len_bytes_idx0 = 0; - len_bytes_idx0 < len_bytes_length; - len_bytes_idx0++) - { - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - // - // ^ YOU ARE HERE - let result_idx0: number = len_bytes_idx0 + 1; - result[result_idx0] = len_bytes[len_bytes_idx0]; - } - // copy original byte array into result - for (let input_idx0 = 0; - input_idx0 < len; - input_idx0++) - { - // <<183 + len_bytes_length, len_bytes, Bytes>> - // 1 byte len_bytes_length bytes len bytes - // - // ^ YOU ARE HERE - let result_idx0: number = input_idx0 + (1 + len_bytes_length); - result[result_idx0] = bytes[input_idx0]; - } - // finally, return the result - return result; - } -} - - - -/** - * Encode a list - * - * @internal - */ -function -encode_list - (list: Array) - : Uint8Array -{ - // first encode every element in the list, then branch - let payloads : Array = list.map(encode); - let payload : Uint8Array = uint8arr_concat(payloads); - let payload_size : number = payload.length; - // if the payload size is in 0..55, then the first byte is 192 + payload - // size, followed by the payload - if - (payload_size <= 55) { - // result: <<(192 + Payload_Size), Payload/binary >>; - // 1 byte payload_size bytes - let result : Uint8Array = new Uint8Array(1 + payload_size); - // result: <<(192 + Payload_Size), Payload/binary >>; - // 1 byte payload_size bytes - // - // ^ YOU ARE HERE - result[0] = 192 + payload_size; - // copy the rest of the payload into result - for (let payload_idx0 = 0; - payload_idx0 < payload_size; - payload_idx0++) - { - // result: <<(192 + Payload_Size), Payload/binary >>; - // 1 byte payload_size bytes - // - // ^ YOU ARE HERE - let result_idx0: number = payload_idx0 + 1; - result[result_idx0] = payload[payload_idx0]; - } - return result; - } - // if the payload size is greater than 55, the first byte is 247 + - // size_of_payload_size, followed by the payload size, followed by the - // payload - else { - // compute the payload size size - let payload_size_bytes : Uint8Array = encode_unsigned(payload_size); - let payload_size_size : number = payload_size_bytes.length; - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - let result: Uint8Array = new Uint8Array(1 + payload_size_size + payload_size); - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - // - // ^ YOU ARE HERE - // first byte is 247 + payload_size_size - result[0] = 247 + payload_size_size; - // copy the payload_size_bytes into result - for (let psb_idx0 = 0; - psb_idx0 < payload_size_size; - psb_idx0++) - { - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - // - // ^ YOU ARE HERE - // offset is 1 byte for this - let result_idx0 : number = psb_idx0 + 1; - result[result_idx0] = payload_size_bytes[psb_idx0]; - } - // copy the payload into result - for (let pb_idx0 = 0; - pb_idx0 < payload_size; - pb_idx0++) - { - // result = <<(247 + payload_size_size), payload_size_bytes/binary, payload/binary >> - // 1 byte payload_size_size bytes payload_size bytes - // - // ^ YOU ARE HERE - // offset is 1 + payload_size_size bytes for this - let result_idx0 : number = pb_idx0 + (1 + payload_size_size); - result[result_idx0] = payload[pb_idx0]; - } - // finally, return result - return result; - } -} - - - -/** - * Encode a number as a bytestring - * - * Not for general use, this assumes the input number is greater than 55 - * - * @internal - */ -function -encode_unsigned - (n: number) - : Uint8Array -{ - // can assume that n initially is greater than 55 - // have to encode it in reverse order - let arr : Array = []; - // repeated division by 256 with remainder - // - // example: suppose bign was 1234 and we were dividing by 10 - // - // iteration 0: - // bign = 1234 - // arr = [] - // --- - // bign / 10 = 123 - // bign % 10 = 4 - // --- - // bign = 123 - // arr = [4] - // - // iteration 1: - // bign = 123 - // arr = [4] - // --- - // bign / 10 = 12 - // bign % 10 = 3 - // --- - // bign = 12 - // arr = [4, 3] - // - // iteration 2: - // bign = 12 - // arr = [4, 3] - // --- - // bign / 10 = 1 - // bign % 10 = 2 - // --- - // bign = 1 - // arr = [4, 3, 2] - // - // iteration 3: - // bign = 1 - // arr = [4, 3, 2] - // --- - // bign / 10 = 0 - // bign % 10 = 1 - // --- - // bign = 0 - // arr = [4, 3, 2, 1] - // - // iteration 4: - // bign = 0 - // arr = [4, 3, 2, 1] - // --- - // DONE - while (n > 0) { - arr.push(n % 256); - n >>= 8; - } - // reverse and make into Uint8Array - arr.reverse(); - return new Uint8Array(arr); -} - - - -/** - * concatenate an array of `Uint8Array`s into a single Uint8Array - * - * @internal - */ -function -uint8arr_concat - (arrs: Array) - : Uint8Array -{ - // total length - let total_len = arrs.reduce(// fold - function (acc_len: number, this_uint8array: Uint8Array): number { - return acc_len + this_uint8array.length; - }, - // initial accumulator - 0); - // start up result - let result : Uint8Array = new Uint8Array(total_len); - let result_idx0 : number = 0; - // concatenate - for (let this_uint8arr of arrs) { - // bytewise copy of this uint8array - for (let this_uint8arr_idx0 = 0; - this_uint8arr_idx0 < this_uint8arr.length; - this_uint8arr_idx0++) - { - // copy byte and increment result idx0 - result[result_idx0] = this_uint8arr[this_uint8arr_idx0]; - result_idx0++; - } - } - return result; -} - -/** - * returns true if input is `instanceof Uint8Array` - * - * @internal - */ -function -is_binary - (x: any) - : boolean -{ - return (x instanceof Uint8Array); -} - - - -/** - * returns true if input is `instanceof Array` - * - * @internal - */ -function -is_list - (x: any) - : boolean -{ - return (x instanceof Array); -} diff --git a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/safe.ts b/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/safe.ts deleted file mode 100644 index b3e4c0c..0000000 --- a/libs/vdk_tests_cases/src/jex_include/local-vdk-0.1.0/src/safe.ts +++ /dev/null @@ -1,112 +0,0 @@ -/** - * "Safe" error handling - * - * The idea here is that there are situations where it is known - * - * ```typescript - * type Safe - * = Ok - * | Error; - * - * type Ok - * = {ok : true, - * result : ok_t}; - * - * type Error - * = {ok : false, - * error : err_t}; - * ``` - * - * 1. a given function call is likely to fail - * 2. the likely errors can be enumerated - * - * These are called "positive errors". An example would be a page script - * asking a browser wallet extension to sign a transaction. The following - * errors, among others, are likely: - * - * - the user does not have a wallet installed - * - the user has a wallet but does not have the correct signing key - * - the user rejects the transaction - * - the sign request timed out - * - * These errors should not generate exceptions, as these behaviors are to some - * degree "expected". - */ - -export { - Safe, - Ok, - Error, - ok, - error, - unsafe -} - - -/** - * Type that catches positive errors - */ -type Safe - = Ok - | Error; - - -/** - * Ok type - */ -type Ok - = {ok : true, - result : ok_t}; - - -/** - * Error type - */ -type Error - = {ok : false, - error : err_t}; - - -/** - * Constructs an `Ok` value from a pure value - */ -function -ok - - (x : ok_t) - : Ok -{ - return {ok: true, result: x}; -} - - - -/** - * Constructs an `Error` value from a pure value - */ -function -error - - (x: err_t) - : Error -{ - return {ok: false, error: x}; -} - - - -/** - * Takes a `Safe` value, if `ok`, returns the `ok_t`, or if an error throws the - * `err_t` - */ -function -unsafe - - (x: Safe) - : ok_t -{ - if (x.ok) - return x.result; - else - throw x.error; -} diff --git a/libs/vdk_tests_cases/src/rlpcases.ts b/libs/vdk_tests_cases/src/rlpcases.ts index 67e6fff..e22aa5d 100644 --- a/libs/vdk_tests_cases/src/rlpcases.ts +++ b/libs/vdk_tests_cases/src/rlpcases.ts @@ -1,4 +1,4 @@ -import * as rlp from './jex_include/local-vdk-0.1.0/dist/rlp.js'; +import * as rlp from './jex_include/local-vdk_rlp-0.1.0/dist/vdk_rlp.js'; type rlpcases = {decoded: rlp.decoded_data, encoded: Uint8Array};