Built production version with Base58 and NetBIOS operations. Closes #48.
parent
701ea5890d
commit
92bd2c921e
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -229,7 +229,9 @@ textarea.arg {
|
|||
display: inline-block;
|
||||
}
|
||||
|
||||
.editable-option-select {}
|
||||
.editable-option-select {
|
||||
min-width: 250px;
|
||||
}
|
||||
|
||||
.editable-option-input {
|
||||
position: absolute;
|
||||
|
|
|
@ -165,7 +165,7 @@ var OperationConfig = {
|
|||
]
|
||||
},
|
||||
"From Base58": {
|
||||
description: "Base58 (similar to Base64) is a notation for encoding arbitrary byte data. It improves upon Base64 by removing easily misread characters (i.e. lI0O) to improve human readability.<br><br>This operation decodes data from an ASCII string (with an alphabet of your choosing, presets included) back into its raw form.<br><br>e.g. <code>StV1DL6CwTryKyV</code> becomes <code>hello world</code><br><br>Base58 is commonly used in cryptocurrencies (Bitcoin, Ripple, etc).",
|
||||
description: "Base58 (similar to Base64) is a notation for encoding arbitrary byte data. It differs from Base64 by removing easily misread characters (i.e. l, I, 0 and O) to improve human readability.<br><br>This operation decodes data from an ASCII string (with an alphabet of your choosing, presets included) back into its raw form.<br><br>e.g. <code>StV1DL6CwTryKyV</code> becomes <code>hello world</code><br><br>Base58 is commonly used in cryptocurrencies (Bitcoin, Ripple, etc).",
|
||||
run: Base58.runFrom,
|
||||
inputType: "string",
|
||||
outputType: "byteArray",
|
||||
|
@ -183,7 +183,7 @@ var OperationConfig = {
|
|||
]
|
||||
},
|
||||
"To Base58": {
|
||||
description: "Base58 (similar to Base64) is a notation for encoding arbitrary byte data. It improves upon Base64 by removing easily misread characters (i.e. lI0O) to improve human readability.<br><br>This operation encodes data in an ASCII string (with an alphabet of your choosing, presets included).<br><br>e.g. <code>hello world</code> becomes <code>StV1DL6CwTryKyV</code><br><br>Base58 is commonly used in cryptocurrencies (Bitcoin, Ripple, etc).",
|
||||
description: "Base58 (similar to Base64) is a notation for encoding arbitrary byte data. It differs from Base64 by removing easily misread characters (i.e. l, I, 0 and O) to improve human readability.<br><br>This operation encodes data in an ASCII string (with an alphabet of your choosing, presets included).<br><br>e.g. <code>hello world</code> becomes <code>StV1DL6CwTryKyV</code><br><br>Base58 is commonly used in cryptocurrencies (Bitcoin, Ripple, etc).",
|
||||
run: Base58.runTo,
|
||||
inputType: "byteArray",
|
||||
outputType: "string",
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
*/
|
||||
var Base58 = {
|
||||
|
||||
|
||||
/**
|
||||
* @constant
|
||||
* @default
|
||||
|
@ -24,15 +23,12 @@ var Base58 = {
|
|||
value: "rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz",
|
||||
},
|
||||
],
|
||||
|
||||
|
||||
/**
|
||||
* @constant
|
||||
* @default
|
||||
*/
|
||||
REMOVE_NON_ALPH_CHARS: true,
|
||||
|
||||
|
||||
/**
|
||||
* To Base58 operation.
|
||||
*
|
||||
|
@ -41,7 +37,10 @@ var Base58 = {
|
|||
* @returns {string}
|
||||
*/
|
||||
runTo: function(input, args) {
|
||||
var alphabet = args[0] || Base58.ALPHABET_OPTIONS[0].value;
|
||||
var alphabet = args[0] || Base58.ALPHABET_OPTIONS[0].value,
|
||||
result = [0];
|
||||
|
||||
alphabet = Utils.expandAlphRange(alphabet).join("");
|
||||
|
||||
if (alphabet.length !== 58 ||
|
||||
[].unique.call(alphabet).length !== 58) {
|
||||
|
@ -50,8 +49,6 @@ var Base58 = {
|
|||
|
||||
if (input.length === 0) return "";
|
||||
|
||||
var result = [0];
|
||||
|
||||
input.forEach(function(b) {
|
||||
var carry = (result[0] << 8) + b;
|
||||
result[0] = carry % 58;
|
||||
|
@ -89,21 +86,19 @@ var Base58 = {
|
|||
* @returns {byteArray}
|
||||
*/
|
||||
runFrom: function(input, args) {
|
||||
var alphabet = args[0] || Base58.ALPHABET_OPTIONS[0].value;
|
||||
var alphabet = args[0] || Base58.ALPHABET_OPTIONS[0].value,
|
||||
removeNonAlphaChars = args[1] === undefined ? true : args[1],
|
||||
result = [0];
|
||||
|
||||
alphabet = Utils.expandAlphRange(alphabet).join("");
|
||||
|
||||
if (alphabet.length !== 58 ||
|
||||
[].unique.call(alphabet).length !== 58) {
|
||||
throw ("Alphabet must be of length 58");
|
||||
}
|
||||
|
||||
var removeNonAlphaChars = args[1];
|
||||
if (removeNonAlphaChars === undefined)
|
||||
removeNonAlphaChars = true;
|
||||
|
||||
if (input.length === 0) return [];
|
||||
|
||||
var result = [0];
|
||||
|
||||
[].forEach.call(input, function(c, charIndex) {
|
||||
var index = alphabet.indexOf(c);
|
||||
|
||||
|
@ -111,7 +106,7 @@ var Base58 = {
|
|||
if (removeNonAlphaChars) {
|
||||
return;
|
||||
} else {
|
||||
throw ("Char " + c + " not in alphabet");
|
||||
throw ("Char '" + c + "' at position " + charIndex + " not in alphabet");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,4 +128,5 @@ var Base58 = {
|
|||
|
||||
return result.reverse();
|
||||
},
|
||||
|
||||
};
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
211 source files
|
||||
115651 lines
|
||||
214 source files
|
||||
115904 lines
|
||||
4.3M size
|
||||
|
||||
142 JavaScript source files
|
||||
106461 lines
|
||||
144 JavaScript source files
|
||||
106712 lines
|
||||
3.8M size
|
||||
|
||||
83 third party JavaScript source files
|
||||
86258 lines
|
||||
86259 lines
|
||||
3.0M size
|
||||
|
||||
59 first party JavaScript source files
|
||||
20203 lines
|
||||
752K size
|
||||
61 first party JavaScript source files
|
||||
20453 lines
|
||||
764K size
|
||||
|
||||
3.5M uncompressed JavaScript size
|
||||
1.9M compressed JavaScript size
|
||||
|
||||
15 categories
|
||||
172 operations
|
||||
176 operations
|
||||
|
|
Loading…
Reference in New Issue