You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

hi-base32

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hi-base32 - npm Package Compare versions

Comparing version

to
0.4.0

2

build/base32.min.js

@@ -9,2 +9,2 @@ /*

*/
!function(){"use strict";var r="object"==typeof window?window:{},t=!r.HI_BASE32_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;t&&(r=global);var a=!r.HI_BASE32_NO_COMMON_JS&&"object"==typeof module&&module.exports,o="function"==typeof define&&define.amd,h="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".split(""),e={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,2:26,3:27,4:28,5:29,6:30,7:31},c=[0,0,0,0,0,0,0,0],n=function(r){for(var t,a,o="",h=r.length,e=0,c=0;h>e;)if(t=r[e++],127>=t)o+=String.fromCharCode(t);else{if(t>191&&223>=t)a=31&t,c=1;else if(239>=t)a=15&t,c=2;else{if(!(247>=t))throw"not a UTF-8 string";a=7&t,c=3}for(var n=0;c>n;++n){if(t=r[e++],128>t||t>191)throw"not a UTF-8 string";a<<=6,a+=63&t}if(a>=55296&&57343>=a)throw"not a UTF-8 string";if(a>1114111)throw"not a UTF-8 string";65535>=a?o+=String.fromCharCode(a):(a-=65536,o+=String.fromCharCode((a>>10)+55296),o+=String.fromCharCode((1023&a)+56320))}return o},A=function(r){r=r.replace(/=/g,"");for(var t,a,o,h,c,n,A,C,f=[],i=0,d=r.length,g=0,s=d>>3<<3;s>g;)t=e[r.charAt(g++)],a=e[r.charAt(g++)],o=e[r.charAt(g++)],h=e[r.charAt(g++)],c=e[r.charAt(g++)],n=e[r.charAt(g++)],A=e[r.charAt(g++)],C=e[r.charAt(g++)],f[i++]=255&(t<<3|a>>>2),f[i++]=255&(a<<6|o<<1|h>>>4),f[i++]=255&(h<<4|c>>>1),f[i++]=255&(c<<7|n<<2|A>>>3),f[i++]=255&(A<<5|C);var u=d-s;return 2===u?(t=e[r.charAt(g++)],a=e[r.charAt(g++)],f[i++]=255&(t<<3|a>>>2)):4===u?(t=e[r.charAt(g++)],a=e[r.charAt(g++)],o=e[r.charAt(g++)],h=e[r.charAt(g++)],f[i++]=255&(t<<3|a>>>2),f[i++]=255&(a<<6|o<<1|h>>>4)):5===u?(t=e[r.charAt(g++)],a=e[r.charAt(g++)],o=e[r.charAt(g++)],h=e[r.charAt(g++)],c=e[r.charAt(g++)],f[i++]=255&(t<<3|a>>>2),f[i++]=255&(a<<6|o<<1|h>>>4),f[i++]=255&(h<<4|c>>>1)):7===u&&(t=e[r.charAt(g++)],a=e[r.charAt(g++)],o=e[r.charAt(g++)],h=e[r.charAt(g++)],c=e[r.charAt(g++)],n=e[r.charAt(g++)],A=e[r.charAt(g++)],f[i++]=255&(t<<3|a>>>2),f[i++]=255&(a<<6|o<<1|h>>>4),f[i++]=255&(h<<4|c>>>1),f[i++]=255&(c<<7|n<<2|A>>>3)),f},C=function(r){for(var t,a,o,e,c,n="",A=r.length,C=0,f=5*parseInt(A/5);f>C;)t=r.charCodeAt(C++),a=r.charCodeAt(C++),o=r.charCodeAt(C++),e=r.charCodeAt(C++),c=r.charCodeAt(C++),n+=h[t>>>3]+h[31&(t<<2|a>>>6)]+h[a>>>1&31]+h[31&(a<<4|o>>>4)]+h[31&(o<<1|e>>>7)]+h[e>>>2&31]+h[31&(e<<3|c>>>5)]+h[31&c];var i=A-f;return 1===i?(t=r.charCodeAt(C),n+=h[t>>>3]+h[t<<2&31]+"======"):2===i?(t=r.charCodeAt(C++),a=r.charCodeAt(C),n+=h[t>>>3]+h[31&(t<<2|a>>>6)]+h[a>>>1&31]+h[a<<4&31]+"===="):3===i?(t=r.charCodeAt(C++),a=r.charCodeAt(C++),o=r.charCodeAt(C),n+=h[t>>>3]+h[31&(t<<2|a>>>6)]+h[a>>>1&31]+h[31&(a<<4|o>>>4)]+h[o<<1&31]+"==="):4===i&&(t=r.charCodeAt(C++),a=r.charCodeAt(C++),o=r.charCodeAt(C++),e=r.charCodeAt(C),n+=h[t>>>3]+h[31&(t<<2|a>>>6)]+h[a>>>1&31]+h[31&(a<<4|o>>>4)]+h[31&(o<<1|e>>>7)]+h[e>>>2&31]+h[e<<3&31]+"="),n},f=function(r){var t,a,o,e,n,A,C,f=!1,i="",d=0,g=0,s=0,u=r.length;do{for(c[0]=c[5],c[1]=c[6],c[2]=c[7],C=g;u>d&&5>C;++d)A=r.charCodeAt(d),128>A?c[C++]=A:2048>A?(c[C++]=192|A>>6,c[C++]=128|63&A):55296>A||A>=57344?(c[C++]=224|A>>12,c[C++]=128|A>>6&63,c[C++]=128|63&A):(A=65536+((1023&A)<<10|1023&r.charCodeAt(++d)),c[C++]=240|A>>18,c[C++]=128|A>>12&63,c[C++]=128|A>>6&63,c[C++]=128|63&A);s+=C-g,g=C-5,d===u&&++d,d>u&&6>C&&(f=!0),t=c[0],C>4?(a=c[1],o=c[2],e=c[3],n=c[4],i+=h[t>>>3]+h[31&(t<<2|a>>>6)]+h[a>>>1&31]+h[31&(a<<4|o>>>4)]+h[31&(o<<1|e>>>7)]+h[e>>>2&31]+h[31&(e<<3|n>>>5)]+h[31&n]):1===C?i+=h[t>>>3]+h[t<<2&31]+"======":2===C?(a=c[1],i+=h[t>>>3]+h[31&(t<<2|a>>>6)]+h[a>>>1&31]+h[a<<4&31]+"===="):3===C?(a=c[1],o=c[2],i+=h[t>>>3]+h[31&(t<<2|a>>>6)]+h[a>>>1&31]+h[31&(a<<4|o>>>4)]+h[o<<1&31]+"==="):4===C&&(a=c[1],o=c[2],e=c[3],i+=h[t>>>3]+h[31&(t<<2|a>>>6)]+h[a>>>1&31]+h[31&(a<<4|o>>>4)]+h[31&(o<<1|e>>>7)]+h[e>>>2&31]+h[e<<3&31]+"=")}while(!f);return i},i=function(r){for(var t,a,o,e,c,n="",A=r.length,C=0,f=5*parseInt(A/5);f>C;)t=r[C++],a=r[C++],o=r[C++],e=r[C++],c=r[C++],n+=h[t>>>3]+h[31&(t<<2|a>>>6)]+h[a>>>1&31]+h[31&(a<<4|o>>>4)]+h[31&(o<<1|e>>>7)]+h[e>>>2&31]+h[31&(e<<3|c>>>5)]+h[31&c];var i=A-f;return 1===i?(t=r[C],n+=h[t>>>3]+h[t<<2&31]+"======"):2===i?(t=r[C++],a=r[C],n+=h[t>>>3]+h[31&(t<<2|a>>>6)]+h[a>>>1&31]+h[a<<4&31]+"===="):3===i?(t=r[C++],a=r[C++],o=r[C],n+=h[t>>>3]+h[31&(t<<2|a>>>6)]+h[a>>>1&31]+h[31&(a<<4|o>>>4)]+h[o<<1&31]+"==="):4===i&&(t=r[C++],a=r[C++],o=r[C++],e=r[C],n+=h[t>>>3]+h[31&(t<<2|a>>>6)]+h[a>>>1&31]+h[31&(a<<4|o>>>4)]+h[31&(o<<1|e>>>7)]+h[e>>>2&31]+h[e<<3&31]+"="),n},d=function(r,t){var a="string"!=typeof r;return a&&r.constructor===ArrayBuffer&&(r=new Uint8Array(r)),a?i(r):t?C(r):f(r)},g=function(r,t){if(!t)return n(A(r));var a,o,h,c,C,f,i,d,g="",s=r.indexOf("=");-1===s&&(s=r.length);for(var u=0,S=s>>3<<3;S>u;)a=e[r.charAt(u++)],o=e[r.charAt(u++)],h=e[r.charAt(u++)],c=e[r.charAt(u++)],C=e[r.charAt(u++)],f=e[r.charAt(u++)],i=e[r.charAt(u++)],d=e[r.charAt(u++)],g+=String.fromCharCode(255&(a<<3|o>>>2))+String.fromCharCode(255&(o<<6|h<<1|c>>>4))+String.fromCharCode(255&(c<<4|C>>>1))+String.fromCharCode(255&(C<<7|f<<2|i>>>3))+String.fromCharCode(255&(i<<5|d));var m=s-S;return 2===m?(a=e[r.charAt(u++)],o=e[r.charAt(u++)],g+=String.fromCharCode(255&(a<<3|o>>>2))):4===m?(a=e[r.charAt(u++)],o=e[r.charAt(u++)],h=e[r.charAt(u++)],c=e[r.charAt(u++)],g+=String.fromCharCode(255&(a<<3|o>>>2))+String.fromCharCode(255&(o<<6|h<<1|c>>>4))):5===m?(a=e[r.charAt(u++)],o=e[r.charAt(u++)],h=e[r.charAt(u++)],c=e[r.charAt(u++)],C=e[r.charAt(u++)],g+=String.fromCharCode(255&(a<<3|o>>>2))+String.fromCharCode(255&(o<<6|h<<1|c>>>4))+String.fromCharCode(255&(c<<4|C>>>1))):7===m&&(a=e[r.charAt(u++)],o=e[r.charAt(u++)],h=e[r.charAt(u++)],c=e[r.charAt(u++)],C=e[r.charAt(u++)],f=e[r.charAt(u++)],i=e[r.charAt(u++)],g+=String.fromCharCode(255&(a<<3|o>>>2))+String.fromCharCode(255&(o<<6|h<<1|c>>>4))+String.fromCharCode(255&(c<<4|C>>>1))+String.fromCharCode(255&(C<<7|f<<2|i>>>3))),g},s={encode:d,decode:g};g.asBytes=A,a?module.exports=s:(r.base32=s,o&&define(function(){return s}))}();
!function(){"use strict";var r="object"==typeof window?window:{};!r.HI_BASE32_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node&&(r=global);var t=!r.HI_BASE32_NO_COMMON_JS&&"object"==typeof module&&module.exports,a="function"==typeof define&&define.amd,o="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".split(""),h={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,2:26,3:27,4:28,5:29,6:30,7:31},e=[0,0,0,0,0,0,0,0],c=function(r){for(var t,a,o,e,c,n,A,C,f=[],i=0,d=(r=r.replace(/=/g,"")).length,g=0,s=d>>3<<3;g<s;)t=h[r.charAt(g++)],a=h[r.charAt(g++)],o=h[r.charAt(g++)],e=h[r.charAt(g++)],c=h[r.charAt(g++)],n=h[r.charAt(g++)],A=h[r.charAt(g++)],C=h[r.charAt(g++)],f[i++]=255&(t<<3|a>>>2),f[i++]=255&(a<<6|o<<1|e>>>4),f[i++]=255&(e<<4|c>>>1),f[i++]=255&(c<<7|n<<2|A>>>3),f[i++]=255&(A<<5|C);var u=d-s;return 2===u?(t=h[r.charAt(g++)],a=h[r.charAt(g++)],f[i++]=255&(t<<3|a>>>2)):4===u?(t=h[r.charAt(g++)],a=h[r.charAt(g++)],o=h[r.charAt(g++)],e=h[r.charAt(g++)],f[i++]=255&(t<<3|a>>>2),f[i++]=255&(a<<6|o<<1|e>>>4)):5===u?(t=h[r.charAt(g++)],a=h[r.charAt(g++)],o=h[r.charAt(g++)],e=h[r.charAt(g++)],c=h[r.charAt(g++)],f[i++]=255&(t<<3|a>>>2),f[i++]=255&(a<<6|o<<1|e>>>4),f[i++]=255&(e<<4|c>>>1)):7===u&&(t=h[r.charAt(g++)],a=h[r.charAt(g++)],o=h[r.charAt(g++)],e=h[r.charAt(g++)],c=h[r.charAt(g++)],n=h[r.charAt(g++)],A=h[r.charAt(g++)],f[i++]=255&(t<<3|a>>>2),f[i++]=255&(a<<6|o<<1|e>>>4),f[i++]=255&(e<<4|c>>>1),f[i++]=255&(c<<7|n<<2|A>>>3)),f},n=function(r,t){if(!t)return function(r){for(var t,a,o="",h=r.length,e=0,c=0;e<h;)if((t=r[e++])<=127)o+=String.fromCharCode(t);else{if(t>191&&t<=223)a=31&t,c=1;else if(t<=239)a=15&t,c=2;else{if(!(t<=247))throw"not a UTF-8 string";a=7&t,c=3}for(var n=0;n<c;++n){if((t=r[e++])<128||t>191)throw"not a UTF-8 string";a<<=6,a+=63&t}if(a>=55296&&a<=57343)throw"not a UTF-8 string";if(a>1114111)throw"not a UTF-8 string";a<=65535?o+=String.fromCharCode(a):(a-=65536,o+=String.fromCharCode(55296+(a>>10)),o+=String.fromCharCode(56320+(1023&a)))}return o}(c(r));var a,o,e,n,A,C,f,i,d="",g=r.indexOf("=");-1===g&&(g=r.length);for(var s=0,u=g>>3<<3;s<u;)a=h[r.charAt(s++)],o=h[r.charAt(s++)],e=h[r.charAt(s++)],n=h[r.charAt(s++)],A=h[r.charAt(s++)],C=h[r.charAt(s++)],f=h[r.charAt(s++)],i=h[r.charAt(s++)],d+=String.fromCharCode(255&(a<<3|o>>>2))+String.fromCharCode(255&(o<<6|e<<1|n>>>4))+String.fromCharCode(255&(n<<4|A>>>1))+String.fromCharCode(255&(A<<7|C<<2|f>>>3))+String.fromCharCode(255&(f<<5|i));var S=g-u;return 2===S?(a=h[r.charAt(s++)],o=h[r.charAt(s++)],d+=String.fromCharCode(255&(a<<3|o>>>2))):4===S?(a=h[r.charAt(s++)],o=h[r.charAt(s++)],e=h[r.charAt(s++)],n=h[r.charAt(s++)],d+=String.fromCharCode(255&(a<<3|o>>>2))+String.fromCharCode(255&(o<<6|e<<1|n>>>4))):5===S?(a=h[r.charAt(s++)],o=h[r.charAt(s++)],e=h[r.charAt(s++)],n=h[r.charAt(s++)],A=h[r.charAt(s++)],d+=String.fromCharCode(255&(a<<3|o>>>2))+String.fromCharCode(255&(o<<6|e<<1|n>>>4))+String.fromCharCode(255&(n<<4|A>>>1))):7===S&&(a=h[r.charAt(s++)],o=h[r.charAt(s++)],e=h[r.charAt(s++)],n=h[r.charAt(s++)],A=h[r.charAt(s++)],C=h[r.charAt(s++)],f=h[r.charAt(s++)],d+=String.fromCharCode(255&(a<<3|o>>>2))+String.fromCharCode(255&(o<<6|e<<1|n>>>4))+String.fromCharCode(255&(n<<4|A>>>1))+String.fromCharCode(255&(A<<7|C<<2|f>>>3))),d},A={encode:function(r,t){var a="string"!=typeof r;return a&&r.constructor===ArrayBuffer&&(r=new Uint8Array(r)),a?function(r){for(var t,a,h,e,c,n="",A=r.length,C=0,f=5*parseInt(A/5);C<f;)t=r[C++],a=r[C++],h=r[C++],e=r[C++],c=r[C++],n+=o[t>>>3]+o[31&(t<<2|a>>>6)]+o[a>>>1&31]+o[31&(a<<4|h>>>4)]+o[31&(h<<1|e>>>7)]+o[e>>>2&31]+o[31&(e<<3|c>>>5)]+o[31&c];var i=A-f;return 1===i?(t=r[C],n+=o[t>>>3]+o[t<<2&31]+"======"):2===i?(t=r[C++],a=r[C],n+=o[t>>>3]+o[31&(t<<2|a>>>6)]+o[a>>>1&31]+o[a<<4&31]+"===="):3===i?(t=r[C++],a=r[C++],h=r[C],n+=o[t>>>3]+o[31&(t<<2|a>>>6)]+o[a>>>1&31]+o[31&(a<<4|h>>>4)]+o[h<<1&31]+"==="):4===i&&(t=r[C++],a=r[C++],h=r[C++],e=r[C],n+=o[t>>>3]+o[31&(t<<2|a>>>6)]+o[a>>>1&31]+o[31&(a<<4|h>>>4)]+o[31&(h<<1|e>>>7)]+o[e>>>2&31]+o[e<<3&31]+"="),n}(r):t?function(r){for(var t,a,h,e,c,n="",A=r.length,C=0,f=5*parseInt(A/5);C<f;)t=r.charCodeAt(C++),a=r.charCodeAt(C++),h=r.charCodeAt(C++),e=r.charCodeAt(C++),c=r.charCodeAt(C++),n+=o[t>>>3]+o[31&(t<<2|a>>>6)]+o[a>>>1&31]+o[31&(a<<4|h>>>4)]+o[31&(h<<1|e>>>7)]+o[e>>>2&31]+o[31&(e<<3|c>>>5)]+o[31&c];var i=A-f;return 1===i?(t=r.charCodeAt(C),n+=o[t>>>3]+o[t<<2&31]+"======"):2===i?(t=r.charCodeAt(C++),a=r.charCodeAt(C),n+=o[t>>>3]+o[31&(t<<2|a>>>6)]+o[a>>>1&31]+o[a<<4&31]+"===="):3===i?(t=r.charCodeAt(C++),a=r.charCodeAt(C++),h=r.charCodeAt(C),n+=o[t>>>3]+o[31&(t<<2|a>>>6)]+o[a>>>1&31]+o[31&(a<<4|h>>>4)]+o[h<<1&31]+"==="):4===i&&(t=r.charCodeAt(C++),a=r.charCodeAt(C++),h=r.charCodeAt(C++),e=r.charCodeAt(C),n+=o[t>>>3]+o[31&(t<<2|a>>>6)]+o[a>>>1&31]+o[31&(a<<4|h>>>4)]+o[31&(h<<1|e>>>7)]+o[e>>>2&31]+o[e<<3&31]+"="),n}(r):function(r){var t,a,h,c,n,A,C,f=!1,i="",d=0,g=0,s=r.length;do{for(e[0]=e[5],e[1]=e[6],e[2]=e[7],C=g;d<s&&C<5;++d)(A=r.charCodeAt(d))<128?e[C++]=A:A<2048?(e[C++]=192|A>>6,e[C++]=128|63&A):A<55296||A>=57344?(e[C++]=224|A>>12,e[C++]=128|A>>6&63,e[C++]=128|63&A):(A=65536+((1023&A)<<10|1023&r.charCodeAt(++d)),e[C++]=240|A>>18,e[C++]=128|A>>12&63,e[C++]=128|A>>6&63,e[C++]=128|63&A);g=C-5,d===s&&++d,d>s&&C<6&&(f=!0),t=e[0],C>4?(a=e[1],h=e[2],c=e[3],n=e[4],i+=o[t>>>3]+o[31&(t<<2|a>>>6)]+o[a>>>1&31]+o[31&(a<<4|h>>>4)]+o[31&(h<<1|c>>>7)]+o[c>>>2&31]+o[31&(c<<3|n>>>5)]+o[31&n]):1===C?i+=o[t>>>3]+o[t<<2&31]+"======":2===C?(a=e[1],i+=o[t>>>3]+o[31&(t<<2|a>>>6)]+o[a>>>1&31]+o[a<<4&31]+"===="):3===C?(a=e[1],h=e[2],i+=o[t>>>3]+o[31&(t<<2|a>>>6)]+o[a>>>1&31]+o[31&(a<<4|h>>>4)]+o[h<<1&31]+"==="):(a=e[1],h=e[2],c=e[3],i+=o[t>>>3]+o[31&(t<<2|a>>>6)]+o[a>>>1&31]+o[31&(a<<4|h>>>4)]+o[31&(h<<1|c>>>7)]+o[c>>>2&31]+o[c<<3&31]+"=")}while(!f);return i}(r)},decode:n};n.asBytes=c,t?module.exports=A:(r.base32=A,a&&define(function(){return A}))}();
# Change Log
## v0.4.0 / 2017-08-16
### Fixed
- TypeScript bug. #4
## v0.3.0 / 2017-08-16

@@ -4,0 +8,0 @@ ### Added

@@ -26,3 +26,3 @@ type Input = string | number[] | ArrayBuffer | Uint8Array;

*/
export var encode(input: Input, asciiOnly?: boolean): string;
export function encode(input: Input, asciiOnly?: boolean): string;
export var decode: Decode;

@@ -1,3 +0,5 @@

Copyright 2015-2017 Chen, Yi-Cyuan
Copyright (c) 2015-2018 Chen, Yi-Cyuan
MIT License
Permission is hereby granted, free of charge, to any person obtaining

@@ -4,0 +6,0 @@ a copy of this software and associated documentation files (the

{
"name": "hi-base32",
"version": "0.3.0",
"version": "0.4.0",
"description": "A simple Base32 encode / decode function for JavaScript supports UTF-8 encoding.",

@@ -9,11 +9,11 @@ "main": "src/base32.js",

"expect.js": "~0.3.1",
"jscoverage": "~0.5.9",
"mocha": "~2.3.4",
"uglify-js": "~2.4.10"
"nyc": "^11.3.0",
"uglify-js": "^3.1.9"
},
"scripts": {
"test": "mocha tests/node-test.js -r jscoverage",
"report": "mocha tests/node-test.js -r jscoverage --covout=html",
"coveralls": "mocha tests/node-test.js -R mocha-lcov-reporter -r jscoverage | coveralls",
"build": "uglifyjs src/base32.js --compress --mangle --comments --output build/base32.min.js"
"test": "nyc mocha tests/node-test.js",
"report": "nyc --reporter=html --reporter=text mocha tests/node-test.js",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"build": "uglifyjs src/base32.js -c -m --comments -o build/base32.min.js"
},

@@ -34,3 +34,8 @@ "repository": {

"url": "https://github.com/emn178/hi-base32/issues"
},
"nyc": {
"exclude": [
"tests"
]
}
}

@@ -263,3 +263,3 @@ /*

'===';
} else if (i === 4) {
} else {
v2 = blocks[1];

@@ -266,0 +266,0 @@ v3 = blocks[2];