aboutsummaryrefslogtreecommitdiffstats
path: root/library/cryptojs/components/enc-base64.js
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2020-08-22 22:14:29 +0200
committerMario Vavti <mario@mariovavti.com>2020-08-22 22:14:29 +0200
commit4e0fc81e5dfaad3c3ed47a02df4589f5b25a88be (patch)
treeeb8d2ffd4840b2cfa50499ac522c3cd276eb8b04 /library/cryptojs/components/enc-base64.js
parent3b865d432ff24532b4a5e6917e23fc42b0d7fcaf (diff)
downloadvolse-hubzilla-4e0fc81e5dfaad3c3ed47a02df4589f5b25a88be.tar.gz
volse-hubzilla-4e0fc81e5dfaad3c3ed47a02df4589f5b25a88be.tar.bz2
volse-hubzilla-4e0fc81e5dfaad3c3ed47a02df4589f5b25a88be.zip
move cryptojs to addon
Diffstat (limited to 'library/cryptojs/components/enc-base64.js')
-rw-r--r--library/cryptojs/components/enc-base64.js109
1 files changed, 0 insertions, 109 deletions
diff --git a/library/cryptojs/components/enc-base64.js b/library/cryptojs/components/enc-base64.js
deleted file mode 100644
index 739f4a845..000000000
--- a/library/cryptojs/components/enc-base64.js
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
-CryptoJS v3.1.2
-code.google.com/p/crypto-js
-(c) 2009-2013 by Jeff Mott. All rights reserved.
-code.google.com/p/crypto-js/wiki/License
-*/
-(function () {
- // Shortcuts
- var C = CryptoJS;
- var C_lib = C.lib;
- var WordArray = C_lib.WordArray;
- var C_enc = C.enc;
-
- /**
- * Base64 encoding strategy.
- */
- var Base64 = C_enc.Base64 = {
- /**
- * Converts a word array to a Base64 string.
- *
- * @param {WordArray} wordArray The word array.
- *
- * @return {string} The Base64 string.
- *
- * @static
- *
- * @example
- *
- * var base64String = CryptoJS.enc.Base64.stringify(wordArray);
- */
- stringify: function (wordArray) {
- // Shortcuts
- var words = wordArray.words;
- var sigBytes = wordArray.sigBytes;
- var map = this._map;
-
- // Clamp excess bits
- wordArray.clamp();
-
- // Convert
- var base64Chars = [];
- for (var i = 0; i < sigBytes; i += 3) {
- var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
- var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;
- var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;
-
- var triplet = (byte1 << 16) | (byte2 << 8) | byte3;
-
- for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {
- base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));
- }
- }
-
- // Add padding
- var paddingChar = map.charAt(64);
- if (paddingChar) {
- while (base64Chars.length % 4) {
- base64Chars.push(paddingChar);
- }
- }
-
- return base64Chars.join('');
- },
-
- /**
- * Converts a Base64 string to a word array.
- *
- * @param {string} base64Str The Base64 string.
- *
- * @return {WordArray} The word array.
- *
- * @static
- *
- * @example
- *
- * var wordArray = CryptoJS.enc.Base64.parse(base64String);
- */
- parse: function (base64Str) {
- // Shortcuts
- var base64StrLength = base64Str.length;
- var map = this._map;
-
- // Ignore padding
- var paddingChar = map.charAt(64);
- if (paddingChar) {
- var paddingIndex = base64Str.indexOf(paddingChar);
- if (paddingIndex != -1) {
- base64StrLength = paddingIndex;
- }
- }
-
- // Convert
- var words = [];
- var nBytes = 0;
- for (var i = 0; i < base64StrLength; i++) {
- if (i % 4) {
- var bits1 = map.indexOf(base64Str.charAt(i - 1)) << ((i % 4) * 2);
- var bits2 = map.indexOf(base64Str.charAt(i)) >>> (6 - (i % 4) * 2);
- words[nBytes >>> 2] |= (bits1 | bits2) << (24 - (nBytes % 4) * 8);
- nBytes++;
- }
- }
-
- return WordArray.create(words, nBytes);
- },
-
- _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
- };
-}());