提交 f5318d5632ca6179808206ab9f10af9628d2ebbe

作者 nheweijun
2 个父辈 1a8b78bb a56d69a9
正在显示 100 个修改的文件 包含 4179 行增加23 行删除

要显示太多修改。

为保证性能只显示 100 of 331 个文件。

... ... @@ -4,7 +4,7 @@ from unittest import result
4 4 from flasgger import swag_from
5 5 from app.util import BlueprintApi
6 6 from app.util import BlueprintApi
7   -from flask import Blueprint, render_template, redirect, request, session, jsonify
  7 +from flask import Blueprint, render_template, redirect, request, session, jsonify, flash
8 8 from .models import *
9 9 from .oauth2 import authorization, generate_user_info, require_oauth
10 10 from authlib.oauth2 import OAuth2Error
... ... @@ -48,7 +48,7 @@ class DataManager(BlueprintApi):
48 48 return jsonify(dict(error.get_body()))
49 49 if not user:
50 50 # 生成验证码
51   -
  51 +
52 52 return render_template("auth/authorize.html",
53 53 user=user,
54 54 grant=grant)
... ... @@ -62,24 +62,34 @@ class DataManager(BlueprintApi):
62 62 error = "密码不可为空"
63 63 else:
64 64 username = request.form.get("username")
65   - # password = SM3.encode(request.form.get("password"))
66   - password = request.form.get("password")
  65 + crypt_pwd = request.form.get("password")
  66 + # password = SM3.encode(crypt_pwd)
  67 + password = SM3.encode(AESHelper.decode(crypt_pwd))
67 68 user = User.query.filter_by(
68 69 username=username, password=password).first()
69 70 if not user:
70 71 error = "账号或密码不正确"
  72 + flash(error)
  73 + # return render_template("auth/authorize.html",
  74 + # grant_user=None,error=error)
71 75
  76 + flash(error)
72 77 if user:
73 78 session["id"] = user.id
74 79 grant_user = user
75 80 return authorization.create_authorization_response(request=request, grant_user=grant_user)
76 81
  82 + # try:
  83 + # grant = authorization.validate_consent_request(end_user=user)
  84 + # except OAuth2Error as error:
  85 + # return jsonify(dict(error.get_body()))
  86 + # return render_template("auth/authorize.html", user=user, grant=grant, error=error)
77 87 try:
78 88 grant = authorization.validate_consent_request(end_user=user)
79 89 except OAuth2Error as error:
80 90 return jsonify(dict(error.get_body()))
81   - # return render_template("auth/authorize.html", user=user, grant=grant, error=error)
82   - return authorization.create_authorization_response(grant_user=None)
  91 + return render_template("auth/authorize.html",
  92 + grant_user=None, error=error)
83 93
84 94 @staticmethod
85 95 @bp.route("/token", methods=["POST"])
... ... @@ -98,21 +108,19 @@ class DataManager(BlueprintApi):
98 108 @staticmethod
99 109 @bp.route("/logout", methods=["GET"])
100 110 def logout():
101   - url = ''
102 111 try:
103   - user = current_user()
104   - grant = authorization.validate_consent_request(end_user=user)
  112 + request2 = authorization.create_oauth2_request(request)
  113 + grant1 = authorization.get_authorization_grant(request=request2)
  114 + redirect_uri = grant1.validate_authorization_request()
105 115 access_token = request.args.get("accesstoken")
106 116 accesstoken = OAuth2Token.query.filter_by(
107 117 access_token=access_token).first()
108 118 accesstoken.revoked = True
109 119 db.session.commit()
110 120 remove_user()
111   - if accesstoken:
112   - url = grant.client.client_uri
113 121 except OAuth2Error as error:
114 122 return jsonify(dict(error.get_body()))
115   - return redirect(url)
  123 + return redirect(redirect_uri)
116 124
117 125 """接口"""
118 126 @staticmethod
... ...
... ... @@ -6,8 +6,7 @@
6 6 from .models import *
7 7 from app.util.component.ApiTemplate import ApiTemplate
8 8 import time
9   -from app.models import SM3
10   -from app.models import AESHelper
  9 +from app.models import SM3, AESHelper
11 10
12 11
13 12 class Api(ApiTemplate):
... ...
... ... @@ -5,16 +5,40 @@ dmap.login = {
5 5 let username = $("#username").val();
6 6 let password = $("#password").val();
7 7
8   - if (username.length <= 0 || password.length <= 0) {
9   - tips.notify("用户名或密码不能为空", "danger", 1e3);
10   - return false;
11   - }
  8 + // if (username.length <= 0 || password.length <= 0) {
  9 + // tips.notify("用户名或密码不能为空", "danger", 1e3);
  10 + // return false;
  11 + // }
12 12
13   - $.post("authorize", { username: username, password: password }, function(data) {
14   - if (!data.result) {
15   - tips.notify("账号或密码错误", "danger", 1e3);
16   - }
17   - })
  13 + let aesKey = JsCrypto.Utf8.parse('w03MyIgc3zMHM5Qe'),
  14 + iv = JsCrypto.Utf8.parse('8765432187654321'),
  15 + instr = JsCrypto.Utf8.parse(password);
  16 + let encryptData = JsCrypto.AES.encrypt(instr, aesKey, {
  17 + iv: iv,
  18 + mode: JsCrypto.mode.CBC,
  19 + padding: JsCrypto.pad.Pkcs7
  20 + });
  21 + let crypt_pwd = encryptData.cipherText.toString();
  22 + let form = document.createElement('form');
  23 + form.method = 'post';
  24 + createElement(form, { username: username, password: crypt_pwd });
  25 + form.style.display = "contents";
  26 + document.body.appendChild(form);
  27 + form.submit();
18 28 });
  29 +
  30 +
  31 + function createElement(form, params) {
  32 + for (const key in params) {
  33 + if (params.hasOwnProperty(key)) {
  34 + const hiddenField = document.createElement('input');
  35 + hiddenField.type = 'hidden';
  36 + hiddenField.name = key;
  37 + hiddenField.value = params[key];
  38 +
  39 + form.appendChild(hiddenField);
  40 + }
  41 + }
  42 + }
19 43 }
20 44 };
\ No newline at end of file
... ...
  1 +import { CipherProps, PropsWithKey } from "./lib/algorithm/cipher/Cipher";
  2 +import type { Word32Array } from "./lib/Word32Array";
  3 +import { BlockCipher, BlockCipherProps } from "./lib/algorithm/cipher/BlockCipher";
  4 +import type { CipherParams } from "./lib/algorithm/cipher/CipherParams";
  5 +export interface AESProps extends BlockCipherProps {
  6 +}
  7 +export declare class AES extends BlockCipher {
  8 + static readonly keySize: number;
  9 + protected _props: PropsWithKey<AESProps>;
  10 + protected _nRounds: number;
  11 + protected _keyPriorReset: Word32Array | undefined;
  12 + protected _keySchedule: number[];
  13 + protected _invKeySchedule: number[];
  14 + constructor(props: PropsWithKey<AESProps>);
  15 + protected _doReset(): void;
  16 + encryptBlock(words: number[], offset: number): void;
  17 + decryptBlock(words: number[], offset: number): void;
  18 + protected _doCryptBlock(words: number[], offset: number, keySchedule: number[], subMix0: number[], subMix1: number[], subMix2: number[], subMix3: number[], sBox: number[]): void;
  19 + /**
  20 + * Creates this cipher in encryption mode.
  21 + *
  22 + * @param {Word32Array} key The key.
  23 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  24 + * @return {Cipher} A cipher instance.
  25 + * @example
  26 + * var cipher = AES.createEncryptor(keyWordArray, { iv: ivWordArray });
  27 + */
  28 + static createEncryptor(key: Word32Array, props?: Partial<CipherProps>): AES;
  29 + /**
  30 + * Creates this cipher in decryption mode.
  31 + *
  32 + * @param {Word32Array} key The key.
  33 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  34 + * @return {Cipher} A cipher instance.
  35 + * @example
  36 + * var cipher = AES.createDecryptor(keyWordArray, { iv: ivWordArray });
  37 + */
  38 + static createDecryptor(key: Word32Array, props?: Partial<CipherProps>): AES;
  39 + /**
  40 + * Encrypt a message with key
  41 + *
  42 + * @param {Word32Array|string} message
  43 + * @param {Word32Array|string} key
  44 + * @param {Partial<AESProps>?} props
  45 + * @example
  46 + * var encryptedMessage = AES.encrypt("test", "pass");
  47 + */
  48 + static encrypt(message: Word32Array | string, key: Word32Array | string, props?: Partial<AESProps>): CipherParams;
  49 + /**
  50 + * Encrypt a encrypted message with key
  51 + *
  52 + * @param {CipherParams|string} cipherParams
  53 + * @param {Word32Array|string} key
  54 + * @param {Partial<AESProps>?} props
  55 + * @example
  56 + * var encryptedMessage = AES.decrypt(cipherProps, "pass");
  57 + */
  58 + static decrypt(cipherParams: CipherParams | string, key: Word32Array | string, props?: Partial<AESProps>): Word32Array;
  59 +}
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var i in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[i]=r[i]}}(this,(function(){return function(){"use strict";var n={6367:function(n,t,r){r.d(t,{Hmac:function(){return e}});var i=r(4768),e=function(){function n(n,t){this.i=n,"string"==typeof t&&(t=i.d.parse(t));var r=n.blockSize,e=4*r;t.nSigBytes>e&&(t=n.finalize(t)),t.clamp();for(var o=this.u=t.clone(),u=this.h=t.clone(),f=o.words,c=u.words,s=0;s<r;s++)f[s]^=1549556828,c[s]^=909522486;u.nSigBytes=e,o.nSigBytes=e,this.reset()}return n.prototype.reset=function(){this.i.reset(),this.i.update(this.h)},n.prototype.update=function(n){return this.i.update(n),this},n.prototype.finalize=function(n){var t=this.i.finalize(n);return this.i.reset(),this.i.finalize(this.u.clone().concat(t))},n}()},5561:function(n,t,r){r.d(t,{SHA256:function(){return v}});var i,e=r(1868),o=r(3354),u=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),f=[],c=[];function s(n){for(var t=Math.sqrt(n),r=2;r<=t;r++)if(!(n%r))return!1;return!0}function a(n){return 4294967296*(n-(0|n))|0}!function(){for(var n=2,t=0;t<64;)s(n)&&(t<8&&(f[t]=a(Math.pow(n,.5))),c[t]=a(Math.pow(n,1/3)),t++),n++}();var h=[],v=function(n){function t(t){var r=n.call(this,t)||this;return r.v=new o.e(f.slice(0)),r.j=t,t&&void 0!==t.hash&&(r.v=t.hash.clone()),r}return u(t,n),t.prototype.O=function(){this.v=new o.e(f.slice(0))},t.prototype.A=function(n,t){for(var r=this.v.words,i=r[0],e=r[1],o=r[2],u=r[3],f=r[4],s=r[5],a=r[6],v=r[7],w=0;w<64;w++){if(w<16)h[w]=0|n[t+w];else{var d=h[w-15],l=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,b=h[w-2],y=(b<<15|b>>>17)^(b<<13|b>>>19)^b>>>10;h[w]=l+h[w-7]+y+h[w-16]}var p=i&e^i&o^e&o,m=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),j=v+((f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25))+(f&s^~f&a)+c[w]+h[w];v=a,a=s,s=f,f=u+j|0,u=o,o=e,e=i,i=j+(m+p)|0}r[0]=r[0]+i|0,r[1]=r[1]+e|0,r[2]=r[2]+o|0,r[3]=r[3]+u|0,r[4]=r[4]+f|0,r[5]=r[5]+s|0,r[6]=r[6]+a|0,r[7]=r[7]+v|0},t.prototype.N=function(){var n=this.k.words,t=8*this.I,r=8*this.k.nSigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=Math.floor(t/4294967296),n[15+(r+64>>>9<<4)]=t,this.k.nSigBytes=4*n.length,this.S(),this.v},t.prototype.clone=function(){return new t({hash:this.v,blockSize:this.U,data:this.k,nBytes:this.I})},t.hash=function(n,r){return new t(r).finalize(n)},t}(e.P)},3354:function(n,t,r){r.d(t,{e:function(){return o}});var i=r(5720),e=r(9054),o=function(){function n(t,r){if(Array.isArray(t)||!t)return this.F=Array.isArray(t)?t:[],void(this.H="number"==typeof r?r:4*this.F.length);if(t instanceof n)return this.F=t.words.slice(),void(this.H=t.nSigBytes);var i;try{t instanceof ArrayBuffer?i=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!i)throw new Error("Invalid argument");for(var e=i.byteLength,o=[],u=0;u<e;u++)o[u>>>2]|=i[u]<<24-u%4*8;this.F=o,this.H=e}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.H},set:function(n){this.H=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.F},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):i.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.F,t=this.H,r=new Uint8Array(t),i=0;i<t;i++)r[i]=n[i>>>2]>>>24-i%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.H%4)for(var i=0;i<r;i++){var e=t[i>>>2]>>>24-i%4*8&255;this.F[this.H+i>>>2]|=e<<24-(this.H+i)%4*8}else for(i=0;i<r;i+=4)this.F[this.H+i>>>2]=t[i>>>2];return this.H+=r,this},n.prototype.clamp=function(){var n=this.H;this.F[n>>>2]&=4294967295<<32-n%4*8,this.F.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.F.slice(),this.H)},n.random=function(t){for(var r=[],i=0;i<t;i+=4)r.push((0,e.M)());return new n(r,t)},n}()},7211:function(n,t,r){r.d(t,{C:function(){return o}});var i=r(3354),e=r(4768),o=function(){function n(n){this.B=0,this.U=0,this.j=n,this.k=n&&void 0!==n.data?n.data.clone():new i.e,this.I=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.U},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.k=void 0!==n?n.clone():new i.e,this.I="number"==typeof t?t:0},n.prototype.K=function(n){var t="string"==typeof n?e.d.parse(n):n;this.k.concat(t),this.I+=t.nSigBytes},n.prototype.S=function(n){var t,r=this.k.words,e=this.k.nSigBytes,o=this.U,u=e/(4*this.U),f=(u=n?Math.ceil(u):Math.max((0|u)-this.B,0))*o,c=Math.min(4*f,e);if(f){for(var s=0;s<f;s+=o)this.A(r,s);t=r.splice(0,f),this.k.nSigBytes-=c}return new i.e(t,c)},n.prototype.A=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,r){r.d(t,{P:function(){return u}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.U=16,r.j=t,t&&"number"==typeof t.blockSize&&(r.U=t.blockSize),r.reset(t?t.data:void 0,t?t.nBytes:void 0),r}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.U},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.O()},t.prototype.update=function(n){return this.K(n),this.S(),this},t.prototype.finalize=function(n){return n&&this.K(n),this.N()},t.prototype.O=function(){throw new Error("Not implemented")},t.prototype.N=function(){throw new Error("Not implemented")},t}(e.C)},787:function(n,t,r){r.d(t,{G:function(){return s}});var i,e=r(9456),o=r(4344),u=r(7919),f=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),c=function(){return(c=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},s=function(n){function t(t){var r=n.call(this,t)||this;return r.U=4,r.R=o.n,r.q=u.l,r.j=t,r.R=void 0!==t.mode?t.mode:r.R,r.q=void 0!==t.padding?t.padding:r.q,r.reset(null==t?void 0:t.data,null==t?void 0:t.nBytes),r}return f(t,n),Object.defineProperty(t.prototype,"mode",{get:function(){return this.J},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"padding",{get:function(){return this.q},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){var i;n.prototype.reset.call(this,t,r),this.L===e.t.ENC_TRANSFORM_MODE?i=this.R.createEncryptor:(i=this.R.createDecryptor,this.B=1),this.R&&this.V===i?this.J=new this.R({cipher:this,iv:this.X}):(this.J=i.call(this.R,{cipher:this,iv:this.X}),this.V=i)},t.prototype.A=function(n,t){var r;null===(r=this.J)||void 0===r||r.processBlock(n,t)},t.prototype.N=function(){var n,t=this.q;return this.L===e.t.ENC_TRANSFORM_MODE?(t.pad(this.k,this.blockSize),n=this.S(!0)):(n=this.S(!0),t.unpad(n)),n},t.prototype.encryptBlock=function(n,t){throw new Error("Not implemented")},t.prototype.decryptBlock=function(n,t){throw new Error("Not implemented")},t.createEncryptor=function(n,r){return new t(c(c({},r=void 0===r?{}:r),{key:n,transformMode:e.t.ENC_TRANSFORM_MODE}))},t.createDecryptor=function(n,r){return new t(c(c({},r=void 0===r?{}:r),{key:n,transformMode:e.t.DEC_TRANSFORM_MODE}))},t}(e.t)},9456:function(n,t,r){r.d(t,{t:function(){return f}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(){return(u=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},f=function(n){function t(t){var r=n.call(this,t)||this;return r.L=1,r.j=t,r.Y=t.key,r.X=void 0!==t.iv?t.iv:r.X,r.L=void 0!==t.transformMode?t.transformMode:r.L,r}return o(t,n),Object.defineProperty(t.prototype,"iv",{get:function(){return this.X},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.O()},t.prototype.process=function(n){return this.K(n),this.S()},t.prototype.finalize=function(n){return n&&this.K(n),this.N()},t.prototype.O=function(){throw new Error("Not implemented")},t.prototype.A=function(n,t){throw new Error("Not implemented")},t.prototype.N=function(){throw new Error("Not implemented")},t.createEncryptor=function(n,r){return new t(u(u({},r=void 0===r?{}:r),{key:n,transformMode:t.ENC_TRANSFORM_MODE}))},t.createDecryptor=function(n,r){return new t(u(u({},r=void 0===r?{}:r),{key:n,transformMode:t.DEC_TRANSFORM_MODE}))},t.ENC_TRANSFORM_MODE=1,t.DEC_TRANSFORM_MODE=2,t.keySize=4,t.ivSize=4,t}(e.C)},2505:function(n,t,r){r.d(t,{Q:function(){return e}});var i=r(1232),e=function(){function n(n){this.formatter=i.w,n&&(this.cipherText=n.cipherText,this.key=n.key,this.iv=n.iv,this.salt=n.salt,this.Algorithm=n.Algorithm,this.mode=n.mode,this.padding=n.padding,this.blockSize=n.blockSize,this.formatter=n.formatter||i.w)}return n.prototype.toString=function(n){return(n||this.formatter).stringify(this)},n}()},5693:function(n,t,r){r.d(t,{E:function(){return c}});var i=r(9109),e=r(2214),o=r(2505),u=r(1232),f=function(){return(f=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},c={encrypt:function(n,t,r,u){var c=u?f({},u):{},s=u&&u.KDF?u.KDF:e.s,a={};u&&u.kdfHasher&&(a.kdfHasher=u.kdfHasher),u&&u.kdfIterations&&(a.kdfIterations=u.kdfIterations),u&&u.kdfModule&&(a.kdfModule=u.kdfModule);var h=s.execute(r,n.keySize,n.ivSize,c.kdfSalt,a);c.iv=h.iv;var v=i.D.encrypt(n,t,h.key,c);return new o.Q(f(f({},v),{key:h.key,iv:h.iv,salt:h.salt}))},decrypt:function(n,t,r,o){var c=o?f({},o):{},s=c.KDF?c.KDF:e.s,a=c.formatter?c.formatter:u.w,h=(0,i.W)(t,a),v={};o&&o.kdfHasher&&(v.kdfHasher=o.kdfHasher),o&&o.kdfIterations&&(v.kdfIterations=o.kdfIterations),o&&o.kdfModule&&(v.kdfModule=o.kdfModule);var w=s.execute(r,n.keySize,n.ivSize,h.salt,v);return c.iv=w.iv,i.D.decrypt(n,h,w.key,c)}}},9109:function(n,t,r){r.d(t,{W:function(){return o},D:function(){return u}});var i=r(1232),e=r(2505);function o(n,t){return"string"==typeof n?t.parse(n):n}var u={encrypt:function(n,t,r,o){var u=n.createEncryptor(r,o),f=u.finalize(t);return new e.Q({cipherText:f,key:r,iv:u.iv,Algorithm:n,mode:u.mode,padding:u.padding,blockSize:u.blockSize,formatter:(null==o?void 0:o.formatter)||i.w})},decrypt:function(n,t,r,e){var u=n.createDecryptor(r,e),f=o(t,(null==e?void 0:e.formatter)||i.w);return u.finalize(f.cipherText||"")}}},1232:function(n,t,r){r.d(t,{w:function(){return u}});var i=r(2505),e=r(3354),o=r(1773),u={stringify:function(n){var t=n.cipherText,r=n.salt;return t?r?new e.e([1398893684,1701076831]).concat(r).concat(t).toString(o.D):t.toString(o.D):""},parse:function(n){var t,r=o.D.parse(n),u=r.words;return 1398893684===u[0]&&1701076831===u[1]&&(t=new e.e(u.slice(2,4)),u.splice(0,4),r.nSigBytes-=16),new i.Q({cipherText:r,salt:t})}}},2214:function(n,t,r){r.d(t,{s:function(){return f}});var i=r(3354),e=r(2505),o=r(7008),u=function(){return(u=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},f={execute:function(n,t,r,f,c){f||(f=i.e.random(8));var s=c&&c.kdfModule||o.E,a=c?{Hasher:c.kdfHasher,iterations:c.kdfIterations}:{},h=s.getKey(n,f,u(u({},a),{keySize:t+r})),v=new i.e(h.words.slice(t),4*r);return h.nSigBytes=4*t,new e.Q({key:h,iv:v,salt:f})}}},7008:function(n,t,r){r.d(t,{E:function(){return s}});var i,e=r(5561),o=r(6367),u=r(3354),f=r(9541),c=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),s=function(n){function t(t){var r=n.call(this,t)||this;return r.Z=4,r.$=e.SHA256,r.nn=1e4,t&&(r.Z=void 0!==t.keySize?t.keySize:r.Z,r.$=void 0!==t.Hasher?t.Hasher:r.$,r.nn=void 0!==t.iterations?t.iterations:r.nn),r}return c(t,n),t.prototype.compute=function(n,t){for(var r=new o.Hmac(new this.$,n),i=new u.e,e=new u.e([1]),f=i.words,c=e.words,s=this.Z,a=this.nn;f.length<s;){var h=r.update(t).finalize(e);r.reset();for(var v=h.words,w=v.length,d=h,l=1;l<a;l++){d=r.finalize(d),r.reset();for(var b=d.words,y=0;y<w;y++)v[y]^=b[y]}i.concat(h),c[0]++}return i.nSigBytes=4*s,i},t.getKey=function(n,r,i){return new t(i).compute(n,r)},t}(f._)},9541:function(n,t,r){r.d(t,{_:function(){return i}});var i=function(){function n(n){this.j=n}return n.prototype.compute=function(n,t){throw new Error("Not implemented")},n.getKey=function(n,t,r){throw new Error("Not implemented")},n}()},1863:function(n,t,r){r.d(t,{T:function(){return i}});var i=function(){function n(n){this.j=n,this.tn=n.cipher,this.X=n.iv}return n.prototype.processBlock=function(n,t){},n.createEncryptor=function(n){throw new Error("Not implemented yet")},n.createDecryptor=function(n){throw new Error("Not implemented yet")},n}()},4344:function(n,t,r){r.d(t,{n:function(){return u}});var i,e=r(1863),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.rn=[],r}return o(t,n),t.prototype.xorBlock=function(n,t,r){var i,e=this.X;e?(i=e.words,this.X=void 0):i=this.rn;for(var o=0;o<r;o++)n[t+o]^=i[o]},t.createEncryptor=function(n){return new t.Encryptor(n)},t.createDecryptor=function(n){return new t.Decryptor(n)},t.Encryptor=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return o(t,n),t.prototype.processBlock=function(n,t){var r=this.tn,i=r.blockSize;this.xorBlock(n,t,i),r.encryptBlock(n,t),this.rn=n.slice(t,t+i)},t}(t),t.Decryptor=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return o(t,n),t.prototype.processBlock=function(n,t){var r=this.tn,i=r.blockSize,e=n.slice(t,t+i);r.decryptBlock(n,t),this.xorBlock(n,t,i),this.rn=e},t}(t),t}(e.T)},7919:function(n,t,r){r.d(t,{l:function(){return e}});var i=r(3354);var e={pad:function(n,t){for(var r=4*t,e=r-n.nSigBytes%r,o=e<<24|e<<16|e<<8|e,u=[],f=0;f<e;f+=4)u.push(o);var c=new i.e(u,e);n.concat(c)},unpad:function(n){var t=255&n.words[n.nSigBytes-1>>>2];n.nSigBytes-=t}}},1756:function(n,t,r){r.d(t,{w:function(){return u}});var i,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(i=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(i)?(i=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(i)&&i):i);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},1773:function(n,t,r){r.d(t,{D:function(){return f}});for(var i=r(3354),e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=[],u=0;u<e.length;u++)o[e.charCodeAt(u)]=u;var f={stringify:function(n){var t=n.words,r=n.nSigBytes;n.clamp();for(var i=[],o=0;o<r;o+=3)for(var u=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,f=0;f<4&&o+.75*f<r;f++)i.push(e.charAt(u>>>6*(3-f)&63));var c=e.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(n){var t=n.length,r=e.charAt(64);if(r){var u=n.indexOf(r);-1!==u&&(t=u)}for(var f=[],c=0,s=0;s<t;s++)if(s%4){var a=o[n.charCodeAt(s-1)]<<s%4*2|o[n.charCodeAt(s)]>>>6-s%4*2;f[c>>>2]|=a<<24-c%4*8,c++}return new i.e(f,c)}}},5720:function(n,t,r){r.d(t,{p:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],e=0;e<t;e+=2)r[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new i.e(r,t/2)}}},8702:function(n,t,r){r.d(t,{m:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(n){for(var t=n.length,r=[],e=0;e<t;e++)r[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new i.e(r,t)}}},4768:function(n,t,r){r.d(t,{d:function(){return e}});var i=r(8702),e={stringify:function(n){try{return decodeURIComponent(escape(i.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return i.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,r){r.d(t,{M:function(){return e}});var i=r(1756);var e=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,i.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function r(i){var e=t[i];if(void 0!==e)return e.exports;var o=t[i]={exports:{}};return n[i](o,o.exports,r),o.exports}r.d=function(n,t){for(var i in t)r.o(t,i)&&!r.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"en",{value:!0})};var i={};return function(){r.r(i),r.d(i,{AES:function(){return j}});var n,t=r(9456),e=r(787),o=r(5693),u=r(9109),f=(n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(t,r)},function(t,r){function i(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}),c=function(){return(c=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},s=[],a=[],h=[],v=[],w=[],d=[],l=[],b=[],y=[],p=[];!function(){for(var n=[],t=0;t<256;t++)n[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var e=i^i<<1^i<<2^i<<3^i<<4;e=e>>>8^255&e^99,s[r]=e,a[e]=r;var o=n[r],u=n[o],f=n[u],c=257*n[e]^16843008*e;h[r]=c<<24|c>>>8,v[r]=c<<16|c>>>16,w[r]=c<<8|c>>>24,d[r]=c,c=16843009*f^65537*u^257*o^16843008*r,l[e]=c<<24|c>>>8,b[e]=c<<16|c>>>16,y[e]=c<<8|c>>>24,p[e]=c,r?(r=o^n[n[n[f^o]]],i^=n[n[i]]):r=i=1}}();var m=[0,1,2,4,8,16,32,64,128,27,54],j=function(n){function r(t){var r=n.call(this,t)||this;return r.on=0,r.un=[],r.fn=[],r.j=t,r.O(),r}return f(r,n),r.prototype.O=function(){var n;if(!this.on||this.cn!==this.Y){for(var t=this.cn=this.Y,r=t.words,i=t.nSigBytes/4,e=4*((this.on=i+6)+1),o=this.un=[],u=0;u<e;u++)u<i?o[u]=r[u]:(n=o[u-1],u%i?i>6&&u%i==4&&(n=s[n>>>24]<<24|s[n>>>16&255]<<16|s[n>>>8&255]<<8|s[255&n]):(n=s[(n=n<<8|n>>>24)>>>24]<<24|s[n>>>16&255]<<16|s[n>>>8&255]<<8|s[255&n],n^=m[u/i|0]<<24),o[u]=o[u-i]^n);this.fn=[];for(var f=0;f<e;f++){u=e-f;n=f%4?o[u]:o[u-4],this.fn[f]=f<4||u<=4?n:l[s[n>>>24]]^b[s[n>>>16&255]]^y[s[n>>>8&255]]^p[s[255&n]]}}},r.prototype.encryptBlock=function(n,t){this.sn(n,t,this.un,h,v,w,d,s)},r.prototype.decryptBlock=function(n,t){var r=n[t+1];n[t+1]=n[t+3],n[t+3]=r,this.sn(n,t,this.fn,l,b,y,p,a),r=n[t+1],n[t+1]=n[t+3],n[t+3]=r},r.prototype.sn=function(n,t,r,i,e,o,u,f){for(var c=this.on,s=n[t]^r[0],a=n[t+1]^r[1],h=n[t+2]^r[2],v=n[t+3]^r[3],w=4,d=1;d<c;d++){var l=i[s>>>24]^e[a>>>16&255]^o[h>>>8&255]^u[255&v]^r[w++],b=i[a>>>24]^e[h>>>16&255]^o[v>>>8&255]^u[255&s]^r[w++],y=i[h>>>24]^e[v>>>16&255]^o[s>>>8&255]^u[255&a]^r[w++],p=i[v>>>24]^e[s>>>16&255]^o[a>>>8&255]^u[255&h]^r[w++];s=l,a=b,h=y,v=p}var m=(f[s>>>24]<<24|f[a>>>16&255]<<16|f[h>>>8&255]<<8|f[255&v])^r[w++],j=(f[a>>>24]<<24|f[h>>>16&255]<<16|f[v>>>8&255]<<8|f[255&s])^r[w++],O=(f[h>>>24]<<24|f[v>>>16&255]<<16|f[s>>>8&255]<<8|f[255&a])^r[w++],g=(f[v>>>24]<<24|f[s>>>16&255]<<16|f[a>>>8&255]<<8|f[255&h])^r[w++];n[t]=m,n[t+1]=j,n[t+2]=O,n[t+3]=g},r.createEncryptor=function(n,i){return new r(c(c({},i=void 0===i?{}:i),{key:n,transformMode:t.t.ENC_TRANSFORM_MODE}))},r.createDecryptor=function(n,i){return new r(c(c({},i=void 0===i?{}:i),{key:n,transformMode:t.t.DEC_TRANSFORM_MODE}))},r.encrypt=function(n,t,i){if("string"==typeof t)return o.E.encrypt(r,n,t,i);if(t.nSigBytes%4!=0)throw new Error("Key size must be multiple of 32bit/4byte/1word");return u.D.encrypt(r,n,t,i)},r.decrypt=function(n,t,i){if("string"==typeof t)return o.E.decrypt(r,n,t,i);if(t.nSigBytes%4!=0)throw new Error("Key size must be multiple of 32bit/4byte/1word");return u.D.decrypt(r,n,t,i)},r.keySize=8,r}(e.G)}(),i}()}));
\ No newline at end of file
... ...
  1 +## API
  2 +`jscrypto` supports crypto modules as well as `cryptojs`.
  3 +
  4 +### *Popular*
  5 +**Hash** [`MD5`][MD5], [`SHA1`][SHA1], [`SHA3`][SHA3], [`SHA224`][SHA224], [`SHA256`][SHA256], [`SHA384`][SHA384], [`SHA512`][SHA512], [`RIPEMD160`][RIPEMD160],
  6 +**Message/Key Hash** [`HMAC-MD5`][HMAC-MD5], [`HMAC-SHA224`][HMAC-SHA224], [`HMAC-SHA256`][HMAC-SHA256], [`HMAC-SHA384`][HMAC-SHA384], [`HMAC-SHA512`][HMAC-SHA512], [`GMAC`][GMAC], [`CBC-MAC`][CBC-MAC]
  7 +**Block Cipher** [`AES`][AES], [`DES`][DES], [`Triple-DES`][Triple-DES]
  8 +
  9 +### *Basic structure*
  10 +**Word** [`Word32Array`][Word32Array], [`Word64Array`][Word64Array]
  11 +**Encoder** [`Base64`][Base64], [`Hex`][Hex], [`Latin1`][Latin1], [`Utf8`][Utf8], [`Utf16`][Utf16]
  12 +
  13 +### *Misc*
  14 +**Stream Cipher** [`Rabbits`][Rabbits], [`RC4`][RC4], [`RC4Drop`][RC4Drop]
  15 +**Key Derive Function** [`OpenSSLKDF`][OpenSSLKDF], [`EvpKDF`][EvpKDF], [`PBKDF2`][PBKDF2]
  16 +**Block Cipher mode** [`CBC`][CBC], [`CFB`][CFB], [`CTR`][CTR], [`ECB`][ECB], [`OFB`][OFB], [`GCM`][GCM], [`CCM`][CCM]
  17 +**Block Padding** [`AnsiX923`][AnsiX923], [`ISO10126`][ISO10126], [`ISO97971`][ISO97971], [`NoPadding`][NoPadding], [`Pkcs7`][Pkcs7], [`Zero`][Zero]
  18 +**Formatter** [`OpenSSLFormatter`][OpenSSLFormatter]
  19 +
  20 +---
  21 +
  22 +### Hash
  23 +#### General
  24 +Hash module can take both string/binary word as a hashing target.
  25 +```js
  26 +JsCrypto.SHA256.hash("string");
  27 +// or
  28 +var w = new Word32Array([0x61626364]); // Binary representation of "abcd"
  29 +JsCrypt.SHA256.hash(w);
  30 +// or
  31 +// Byte array can be hashed.
  32 +// ArrayBuffer | Uint8Array | Int8Array | Uint8ClampedArray | Int16Array | Uint16Array
  33 +// Int32Array | Uint32Array | Float32Array | Float64Array
  34 +var w = new Word32Array(typedArray);
  35 +JsCrypt.SHA256.hash(w);
  36 +```
  37 +
  38 +<h4 id='md5'>MD5</h4>
  39 +
  40 +```js
  41 +// MD.hash(string)
  42 +// Return value of 'hash' is Word32Array
  43 +var hashedWord = JsCrypto.MD5.hash("abc");
  44 +hashedWord.toString(); // "900150983cd24fb0d6963f7d28e17f72"
  45 +hashedWord.toString(JsCrypto.Hex); // "900150983cd24fb0d6963f7d28e17f72"
  46 +hashedWord.toString(JsCrypto.Base64); // "kAFQmDzST7DWlj99KOF/cg=="
  47 +
  48 +// Binary words can be hashed as well.
  49 +// binary representation of "abc"
  50 +var w = new JsCrypto.Word32Array([0x61626300], 3);
  51 +var hashedWord = JsCrypto.MD5.hash(w);
  52 +hashedWord.toString(); // "900150983cd24fb0d6963f7d28e17f72"
  53 +
  54 +// binary representation of "abcd"
  55 +var w2 = new JsCrypto.Word32Array([0x61626364]);
  56 +var hashedWord = JsCrypto.MD5.hash(w2);
  57 +hashedWord.toString(); // "e2fc714c4727ee9395f324cd2e7f331f"
  58 +
  59 +// You can do gradual update
  60 +var md5 = new JsCrypto.MD5("");
  61 +md5.update("a");
  62 +md5.update("b");
  63 +md5.update("c");
  64 +var hashedWord = md5.finalize();
  65 +hashedWord.toString(); // The same as Jscrypto.MD5.hash("abc").toString(); "900150983cd24fb0d6963f7d28e17f72"
  66 +```
  67 +
  68 +<h4 id='sha1'>SHA1</h4>
  69 +
  70 +```js
  71 +// SHA1.hash(string)
  72 +var hashedWord = JsCrypto.SHA1.hash("abc"); // Return value of 'hash' is Word32Array
  73 +hashedWord.toString(); // "a9993e364706816aba3e25717850c26c9cd0d89d"
  74 +hashedWord.toString(JsCrypto.Hex); // "a9993e364706816aba3e25717850c26c9cd0d89d"
  75 +hashedWord.toString(JsCrypto.Base64); // "qZk+NkcGgWq6PiVxeFDCbJzQ2J0="
  76 +
  77 +// Binary words can be hashed as well as MD5. See MD5 example above.
  78 +// You can do gradual update as well as MD5. See MD5 example above.
  79 +```
  80 +
  81 +<h4 id='sha3'>SHA3</h4>
  82 +
  83 +```js
  84 +// SHA3.hash(string)
  85 +var hashedWord = JsCrypto.SHA3.hash("abc"); // Return value of 'hash' is Word32Array
  86 +hashedWord.toString(); // "18587dc2ea10...7aa511a9d00bb96"
  87 +hashedWord.toString(JsCrypto.Hex); // "18587dc2ea10...7aa511a9d00bb96"
  88 +hashedWord.toString(JsCrypto.Base64); // "GFh9wuoQa5oVY...plsZ13qlEanQC7lg=="
  89 +
  90 +// Binary words can be hashed as well as MD5. See MD5 example above.
  91 +// You can do gradual update as well as MD5. See MD5 example above.
  92 +```
  93 +
  94 +<h4 id='sha224'>SHA224</h4>
  95 +
  96 +```js
  97 +// SHA224.hash(string)
  98 +var hashedWord = JsCrypto.SHA224.hash("abc"); // Return value of 'hash' is Word32Array
  99 +hashedWord.toString(); // "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7"
  100 +hashedWord.toString(JsCrypto.Hex); // "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7"
  101 +hashedWord.toString(JsCrypto.Base64); // "Iwl9IjQF2CKGQqR3vaJVsyqtvOS9oLP342ydpw=="
  102 +
  103 +// Binary words can be hashed as well as MD5. See MD5 example above.
  104 +// You can do gradual update as well as MD5. See MD5 example above.
  105 +```
  106 +
  107 +<h4 id='sha256'>SHA256</h4>
  108 +
  109 +```js
  110 +// SHA256.hash(string)
  111 +var hashedWord = JsCrypto.SHA256.hash("abc"); // Return value of 'hash' is Word32Array
  112 +hashedWord.toString(); // "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"
  113 +hashedWord.toString(JsCrypto.Hex); // "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"
  114 +hashedWord.toString(JsCrypto.Base64); // "ungWv48Bz+pBQUDeXa4iI7ADYaOWF3qctBD/YfIAFa0="
  115 +
  116 +// Binary words can be hashed as well as MD5. See MD5 example above.
  117 +// You can do gradual update as well as MD5. See MD5 example above.
  118 +```
  119 +
  120 +<h4 id='sha384'>SHA384</h4>
  121 +
  122 +```js
  123 +// SHA384.hash(string)
  124 +var hashedWord = JsCrypto.SHA384.hash("abc"); // Return value of 'hash' is Word32Array
  125 +hashedWord.toString(); // "cb00753f45a35...2358baeca134c825a7"
  126 +hashedWord.toString(JsCrypto.Hex); // "cb00753f45a35...2358baeca134c825a7"
  127 +hashedWord.toString(JsCrypto.Base64); // "ywB1P0WjXou1oD1pm...croefMI1i67KE0yCWn"
  128 +
  129 +// Binary words can be hashed as well as MD5. See MD5 example above.
  130 +// You can do gradual update as well as MD5. See MD5 example above.
  131 +```
  132 +
  133 +<h4 id='sha512'>SHA512</h4>
  134 +
  135 +```js
  136 +// SHA512.hash(string)
  137 +var hashedWord = JsCrypto.SHA512.hash("abc"); // Return value of 'hash' is Word32Array
  138 +hashedWord.toString(); // "ddaf35a19361...2a9ac94fa54ca49f"
  139 +hashedWord.toString(JsCrypto.Hex); // "ddaf35a19361...2a9ac94fa54ca49f"
  140 +hashedWord.toString(JsCrypto.Base64); // "3a81oZNherrMQXNJ...2Q86A4qmslPpUyknw=="
  141 +
  142 +// Binary words can be hashed as well as MD5. See MD5 example above.
  143 +// You can do gradual update as well as MD5. See MD5 example above.
  144 +```
  145 +
  146 +<h4 id='ripemd160'>RIPEMD160</h4>
  147 +
  148 +```js
  149 +// RIPEMD160.hash(string)
  150 +var hashedWord = JsCrypto.RIPEMD160.hash("abc"); // Return value of 'hash' is Word32Array
  151 +hashedWord.toString(); // "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc"
  152 +hashedWord.toString(JsCrypto.Hex); // "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc"
  153 +hashedWord.toString(JsCrypto.Base64); // "jrII9+BdmHqbBEqOmMawh/FaC/w="
  154 +
  155 +// Binary words can be hashed as well as MD5. See MD5 example above.
  156 +// You can do gradual update as well as MD5. See MD5 example above.
  157 +```
  158 +
  159 +### Message/Key Hash
  160 +#### General
  161 +HMAC function can be generated from hash function as below.
  162 +```js
  163 +var hmacMD5 = new JsCrypto.Hmac(new JsCrypto.MD5(), "key");
  164 +var words = hmacMD5.finalize("message");
  165 +words.toString(); // "4e4748e62b463521f6775fbf921234b5"
  166 +// or
  167 +var hmacSHA1 = new JsCrypto.Hmac(new JsCrypto.SHA1(), "key");
  168 +var words = hmacSHA1.finalize("message");
  169 +words.toString(); // "2088df74d5f2146b48146caf4965377e9d0be3a4"
  170 +// or simply
  171 +JsCrypto.HmacSHA256("message", "key").toString(); // "6e9ef29b75fffc5b7ab...76917343065f58ed4a"
  172 +
  173 +```
  174 +
  175 +<h4 id='hmac-md5'>HMAC-MD5</h4>
  176 +
  177 +```js
  178 +var hashedWord = JsCrypto.HmacMD5("message", "key");
  179 +hashedWord.toString(); // "4e4748e62b463521f6775fbf921234b5"
  180 +hashedWord.toString(JsCrypto.Base64); // "TkdI5itGNSH2d1+/khI0tQ=="
  181 +
  182 +// Binary message can be hashed.
  183 +// Binary representation of "message"
  184 +var message = new JsCrypto.Word32Array([0x6d657373, 0x61676500], 7);
  185 +var hashedWord = JsCrypto.HmacMD5(message, "key");
  186 +hashedWord.toString(); // "4e4748e62b463521f6775fbf921234b5"
  187 +
  188 +// Key also can be a binary
  189 +// Binary representation of "message"
  190 +var message = new JsCrypto.Word32Array([0x6d657373, 0x61676500], 7);
  191 +// Binary representation of "key"
  192 +var key = new JsCrypto.Word32Array([0x6b657900], 3);
  193 +var hashedWord = JsCrypto.HmacMD5(message, key);
  194 +hashedWord.toString(); // "4e4748e62b463521f6775fbf921234b5"
  195 +
  196 +// Gradual update
  197 +var hmacMD5 = new JsCrypto.Hmac(new JsCrypto.MD5(), "key");
  198 +hmacMD5.update("me");
  199 +hmacMD5.update("ss");
  200 +hmacMD5.update("ag");
  201 +var w = hmacMD5.finalize("e");
  202 +w.toString(); // "4e4748e62b463521f6775fbf921234b5"
  203 +```
  204 +
  205 +<h4 id='hmac-sha224'>HMAC-SHA224</h4>
  206 +
  207 +```js
  208 +var hashedWord = JsCrypto.HmacSHA224("message", "key");
  209 +hashedWord.toString(); // "a0b5eecae3f74f0561a8da6f389f78f1a3895c8c183c31c1756d7925"
  210 +hashedWord.toString(JsCrypto.Base64); // "oLXuyuP3TwVhqNpvOJ948aOJXIwYPDHBdW15JQ=="
  211 +
  212 +// Binary message can be hashed as well as HMAC-MD5. See HMAC-MD5 example above.
  213 +// Key also can be a binary as well as HMAC-MD5. See HMAC-MD5 example above.
  214 +// Can Gradual update as well as HMAC-MD5. See HMAC-MD5 example above.
  215 +```
  216 +
  217 +<h4 id='hmac-sha256'>HMAC-SHA256</h4>
  218 +
  219 +```js
  220 +var hashedWord = JsCrypto.HmacSHA256("message", "key");
  221 +hashedWord.toString(); // "6e9ef29b75fffc5b7abae527d58fdadb2fe42e7219011976917343065f58ed4a"
  222 +hashedWord.toString(JsCrypto.Base64); // "bp7ym3X//Ft6uuUn1Y/a2y/kLnIZARl2kXNDBl9Y7Uo="
  223 +
  224 +// Binary message can be hashed as well as HMAC-MD5. See HMAC-MD5 example above.
  225 +// Key also can be a binary as well as HMAC-MD5. See HMAC-MD5 example above.
  226 +// Can Gradual update as well as HMAC-MD5. See HMAC-MD5 example above.
  227 +```
  228 +
  229 +<h4 id='hmac-sha384'>HMAC-SHA384</h4>
  230 +
  231 +```js
  232 +var hashedWord = JsCrypto.HmacSHA384("message", "key");
  233 +hashedWord.toString(); // "0fd3ae3237be98c64a075...544b9062c773b2d86f"
  234 +hashedWord.toString(JsCrypto.Base64); // "D9OuMje+m...EuQYsdzsthv"
  235 +
  236 +// Binary message can be hashed as well as HMAC-MD5. See HMAC-MD5 example above.
  237 +// Key also can be a binary as well as HMAC-MD5. See HMAC-MD5 example above.
  238 +// Can Gradual update as well as HMAC-MD5. See HMAC-MD5 example above.
  239 +```
  240 +
  241 +<h4 id='hmac-sha512'>HMAC-SHA512</h4>
  242 +
  243 +```js
  244 +var hashedWord = JsCrypto.HmacSHA512("message", "key");
  245 +hashedWord.toString(); // ""e477384d7ca2...16810fa367e98"
  246 +hashedWord.toString(JsCrypto.Base64); // "5Hc4TXyiKd0UJuZ...xp9NdbQ0IWgQ+jZ+mA=="
  247 +
  248 +// Binary message can be hashed as well as HMAC-MD5. See HMAC-MD5 example above.
  249 +// Key also can be a binary as well as HMAC-MD5. See HMAC-MD5 example above.
  250 +// Can Gradual update as well as HMAC-MD5. See HMAC-MD5 example above.
  251 +```
  252 +
  253 +<h4 id='gmac'>GMAC</h4>
  254 +
  255 +Default Cipher: `AES`.
  256 +If you do not supply `iv` to GMAC, `iv` is initialized to 0^128. (128bit 0s)
  257 +```js
  258 +var message = JsCrypto.Hex.parse("1063509E5A672C092CAD0B1DC6CE009A61AAAAAAAAAAAA");
  259 +var key = JsCrypto.Hex.parse("55804F3AEB4E914DC91255944A1F565A");
  260 +var iv = JsCrypto.Hex.parse("BBBBBBBBBBBBBBBBBBBBBBBB"); // 96bit(12byte) iv is recommended.
  261 +var tagLength = 8; // 8byte. Optional. If omitted, tagLength will be set to 16(byte).
  262 +
  263 +var authTagWord = JsCrypto.GMAC(message, key, iv, tagLength);
  264 +authTagWord.toString(); // 44c955d637994285
  265 +authTagWord.toString(JsCrypto.Base64); // "RMlV1jeZQoU="
  266 +```
  267 +
  268 +<h4 id='cbc-mac'>CBC-MAC</h4>
  269 +
  270 +Default Cipher: `AES`.
  271 +If you set `Nonce` below to falsy value like `null|undefined|0`, Nonce will be reset to `new Word32Array([0, 0], 8);` (64bit/8byte 0s).
  272 +
  273 +Please note that there are many implementations of CBC-MAC in the world. Some implementation says CBC-MAC is just
  274 +the final processed block of CBC with iv=0.
  275 +So you need to take extra care what implementation is used if you are just told to "Go get Message-Authentication-Code with CBC-MAC".
  276 +For `jscrypto`, it implements `CBC-MAC` so that it satisfies [NIST 800-38C specification and its test vectors](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38c.pdf).
  277 +
  278 +For additional description, [please read this](#note-for-ccm-implementation).
  279 +
  280 +```js
  281 +var Plaintext = JsCrypto.Hex.parse("20212223");
  282 +var Message = JsCrypto.Hex.parse("0001020304050607");
  283 +var Key = JsCrypto.Hex.parse("404142434445464748494a4b4c4d4e4f");
  284 +var Nonce = undefined; // Nonce/iv shouldn't be used. Always set to be `undefined` or `new Word32Array([0,0], 8)`
  285 +var tagLength = 32/8; // 32bit = 4byte
  286 +
  287 +var authTagWord = JsCrypto.CBCMAC(Plaintext, Message, Key, Nonce, tagLength);
  288 +authTagWord.toString(); // "9bd4029e"
  289 +```
  290 +
  291 +### Block Cipher
  292 +
  293 +<h4 id="aes">AES</h4>
  294 +
  295 +Default block cipher mode: `CBC`
  296 +Default padding: `Pkcs7`
  297 +
  298 +```js
  299 +////////////////////////////////////////////////////////////////////////////////////////
  300 +// Encrypt/Decrypt string without specifying salt. (Salt is randomly chosen at runtime)
  301 +// *Salt is used to convert string password to binary key.
  302 +////////////////////////////////////////////////////////////////////////////////////////
  303 +// Default block cipher mode is CBC, pad is Pkcs7.
  304 +// Random base64 string which contains encrypted message and 'random' salt for kdf.
  305 +var encryptedData = JsCrypto.AES.encrypt("message", "key").toString();
  306 +// Binary data is returned as Word32Array.
  307 +var decryptedData = JsCrypto.AES.decrypt(encryptedData, "key");
  308 +decryptedData.toString(JsCrypto.Utf8); // "message"
  309 +
  310 +////////////////////////////////////////////////////////////////////////////////////////
  311 +// Encrypt/Decrypt string with pre-defined kdf salt.
  312 +////////////////////////////////////////////////////////////////////////////////////////
  313 +var kdfSalt = new JsCrypto.Word32Array([0x00112233, 0x44556677]); // Or JsCrypto.Hex.parse("0011223344556677")
  314 +// Always "U2FsdGVkX18AESIzRFVmd1MuEw84PQjNhlcGD3AQzJg=" because salt for kdf is fixed.
  315 +var encryptedData = JsCrypto.AES.encrypt("message", "key", {kdfSalt: kdfSalt}).toString();
  316 +// Binary data is returned as Word32Array.
  317 +var decryptedData = JsCrypto.AES.decrypt(encryptedData, "key");
  318 +decryptedData.toString(JsCrypto.Utf8); // "message"
  319 +
  320 +////////////////////////////////////////////////////////////////////////////////////////
  321 +// Encrypt/Decrypt string with binary key.
  322 +////////////////////////////////////////////////////////////////////////////////////////
  323 +// key lenght must be multiple of 32bit=4byte=1word. (32/64/96/128/160/192/224/256bit key supported for AES)
  324 +var key = JsCrypto.Hex.parse("00112233445566778899aabbccddeeff"); // 16byte = 128bit key
  325 +// Always "dwhN2ILLN9QJD+BQr0kcsw==" because of a fixed key.
  326 +var encryptedData = JsCrypto.AES.encrypt("message", key).toString();
  327 +// Binary data is returned as Word32Array.
  328 +var decryptedData = JsCrypto.AES.decrypt(encryptedData, key);
  329 +decryptedData.toString(JsCrypto.Utf8); // "message"
  330 +
  331 +////////////////////////////////////////////////////////////////////////////////////////
  332 +// When you want to store/copy encrypted data somewhere, be sure to have 'stringified' data.
  333 +// Don't save 'encryptedDataObj' below, because this contains encryption key itself.
  334 +////////////////////////////////////////////////////////////////////////////////////////
  335 +// Always 'stringify' this 'encryptedDataObj' then port it anywhere.
  336 +var encryptedDataObj = JsCrypto.AES.encrypt("message", "key");
  337 +// Return value of 'toString()' is a Base64 string containing only encrypted data and kdf salt
  338 +var encryptedData = encryptedDataObj.toString();
  339 +
  340 +////////////////////////////////////////////////////////////////////////////////////////
  341 +// Encrypt not only a string but also binary data(ArrayBuffer, Uint8Array, etc)
  342 +////////////////////////////////////////////////////////////////////////////////////////
  343 +const fileElement = document.querySelector("input[type='file']");
  344 +const file = fileElement.files[0];
  345 +const reader = new FileReader();
  346 +reader.onload = function(e){
  347 + const arrayBuffer = reader.result;
  348 + const binaryWord = new JsCrypto.Word32Array(arrayBuffer);
  349 + const encryptedData = JsCrypto.AES.encrypt(binaryWord, "password").toString();
  350 +
  351 + // Store it to localStorage, etc.
  352 + localStorage.setItem("secretFile", encryptedData);
  353 +
  354 + // You can decrypt it like below
  355 + // Returned value is Word32Array
  356 + const decryptedData = JsCrypto.AES.decrypt(encryptedData, "password");
  357 + // Word32Array can be turned to Uint8Array.
  358 + const decryptedFile = decryptedData.toUint8Array();
  359 + // You can then convert it to ArrayBuffer;
  360 + const decryptedFileArrayBuffer = decryptedFile.buffer;
  361 +};
  362 +reader.readAsArrayBuffer(file);
  363 +
  364 +////////////////////////////////////////////////////////////////////////////////////////
  365 +// Options for block cipher like AES.
  366 +////////////////////////////////////////////////////////////////////////////////////////
  367 +// CBC/ECB/CTR/OFB/CFB is the options. CBC is the default.
  368 +var mode = JsCrypto.mode.CBC;
  369 +// AnsiX923/ISO10126/ISO97971/Pkcs7/NoPadding/Zero is the options. Pkcs7 is the default.
  370 +var padding = JsCrypto.pad.Pkcs7;
  371 +// PBKDF2/EvpKDF is the options. PBKDF2 is the default.
  372 +var kdfModule = JsCrypto.PBKDF2;
  373 +// MD5/SHA1/SHA3/SHA224/SHA256/SHA384/SHA512/RIPEMD160 is the options. SHA256 is the default
  374 +var kdfHasher = JsCrypto.SHA256;
  375 +// 10000 is the default value.
  376 +var kdfIterations = 10000;
  377 +// Salt used in key derivation. If omitted, salt is randomly chosen. Random generation is strongly recommended.
  378 +var kdfSalt = JsCrypto.Hex.parse("daefe2565e3c4680");
  379 +var aesProps = {mode, padding, kdfModule, kdfSalt, kdfHasher, kdfIterations};
  380 +
  381 +var cipherParams = JsCrypto.AES.encrypt("message", "password", aesProps);
  382 +// Gets "U2FsdGVkX1/a7+JWXjxGgCXR5T2J97jwBZAKtZNXZI4=". OpenSSL compatible format. See detail in OpenSSLFormatter section.
  383 +var encryptedData = cipherParams.toString();
  384 +
  385 +var decrypted = JsCrypto.AES.decrypt(encryptedData, "password", aesProps);
  386 +decrypted.toString(JsCrypto.Utf8); // "message"
  387 +```
  388 +
  389 +When you supply encryption key as a string password, it automatically generates 256bit key for encryption. (AES-256).
  390 +
  391 +<h4 id="des">DES</h4>
  392 +
  393 +
  394 +Default block cipher mode: `CBC`
  395 +Default padding: `Pkcs7`
  396 +
  397 +```js
  398 +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  399 +// Encrypt/Decrypt string without specifying salt. (Salt is randomly chosen at runtime)
  400 +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  401 +// Default block cipher mode is CBC, pad is Pkcs7.
  402 +// Random base64 string which contains encrypted message and 'random' salt.
  403 +var encryptedData = JsCrypto.DES.encrypt("message", "key").toString();
  404 +// Binary data is returned as Word32Array.
  405 +var decryptedData = JsCrypto.DES.decrypt(encryptedData, "key");
  406 +// Specify encoding and you get "message"
  407 +decryptedData.toString(JsCrypto.Utf8);
  408 +
  409 +// For additinal feature, please see AES example and replace 'AES' to 'DES'.
  410 +```
  411 +
  412 +<h4 id="des3">Triple-DES</h4>
  413 +
  414 +
  415 +Default block cipher mode: `CBC`
  416 +Default padding: `Pkcs7`
  417 +
  418 +Triple-DES requires the key length to be 64, 128, 192 or >192bit.
  419 +If string key is provided, it is automaically converted to 192bit key by key derivation function.
  420 +
  421 +```js
  422 +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  423 +// Encrypt/Decrypt string without specifying salt. (Salt is randomly chosen at runtime)
  424 +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  425 +// Default block cipher mode is CBC, pad is Pkcs7.
  426 +// Random base64 string which contains encrypted message and 'random' salt.
  427 +var encryptedData = JsCrypto.DES3.encrypt("message", "key").toString();
  428 +// Binary data is returned as Word32Array.
  429 +var decryptedData = JsCrypto.DES3.decrypt(encryptedData, "key");
  430 +// Specify encoding and you get "message"
  431 +decryptedData.toString(JsCrypto.Utf8);
  432 +
  433 +// For additinal feature, please see AES example and replace 'AES' to 'DES3'.
  434 +```
  435 +
  436 +### Word
  437 +The basic instance holding binary value.
  438 +<h4 id='word32array'>Word32Array</h4>
  439 +
  440 +```js
  441 +// Example of Word32Array constructor.
  442 +// Given 'new Word32Array(A, B)', A: array of 32bit word, B: the number of significant bytes.
  443 +
  444 +// Binary representation of "abcdefgh"
  445 +var abcdefgh = new JsCrypto.Word32Array([0x61626364, 0x65666768]);
  446 +// Binary representation of "abcdefg"
  447 +var abcdefg = new JsCrypto.Word32Array([0x61626364, 0x65666768], 7);
  448 +// Binary representation of "abcdef"
  449 +var abcdef = new JsCrypto.Word32Array([0x61626364, 0x65666768], 6);
  450 +// Binary representation of "abcd"
  451 +var abcd = new JsCrypto.Word32Array([0x61626364, 0x65666768], 4);
  452 +// This also represents "abcd"
  453 +var abcd2 = new JsCrypto.Word32Array([0x61626364]);
  454 +
  455 +// Example of stringify
  456 +var w = new JsCrypto.Word32Array([0x1234567, 0x89abcdef]);
  457 +// Word32Array.toString(encoder?: IEncoder)
  458 +w.toString(); // "0123456789abcdef"
  459 +w.toString(JsCrypto.Hex); // "0123456789abcdef"
  460 +w.toString(JsCrypto.Base64); // "ASNFZ4mrze8="
  461 +
  462 +// Word32Array can be genereated from parser.
  463 +// The same as 'new Word32Array([0x01234567, 0x89abcdef])'
  464 +JsCrypto.Hex.parse("0123456789abcdef");
  465 +// The same as 'new Word32Array([0x01234567, 0x89abcdef])'
  466 +JsCrypto.Base64.parse("ASNFZ4mrze8=");
  467 +// The same as 'new Word32Array([0x61626364])'
  468 +JsCrypto.Utf8.parse("abcd");
  469 +```
  470 +
  471 +<h4 id='word64array'>Word64Array</h4>
  472 +
  473 +```js
  474 +var w1 = new Word64Array([new Word64(0x00010203, 0x04050607)]);
  475 +w1.toString(); // "0001020304050607"
  476 +w1.nSigBytes; // 8
  477 +
  478 +var w2 = w1.to32();
  479 +w2.toString(); // "0001020304050607"
  480 +w2.nSigBytes; // 8
  481 +```
  482 +
  483 +### Encoder
  484 +<h4 id='base64'>Base64</h4>
  485 +
  486 +```js
  487 + var w = new JsCrypto.Word32Array([0x00000000]);
  488 +
  489 +// Base64.stringify
  490 +JsCrypto.Base64.stringify(w); // "AAAAAA=="
  491 +// or
  492 +w.toString(JsCrypto.Base64); // "AAAAAA=="
  493 +
  494 +// Base64.parse
  495 +JsCrypto.Base64.parse("AAAAAA=="); // Word32Array. 0x00000000
  496 +JsCrypto.Base64.parse("AAAAAA==").toString(); // "00000000"
  497 +```
  498 +
  499 +<h4 id='hex'>Hex</h4>
  500 +
  501 +```js
  502 + var w = new JsCrypto.Word32Array([0x00102030]);
  503 +
  504 +// Hex.stringify
  505 +JsCrypto.Hex.stringify(w); // "00102030"
  506 +// or
  507 +w.toString(JsCrypto.Hex); // "00102030"
  508 +
  509 +// Hex.parse
  510 +JsCrypto.Hex.parse("00102030"); // Word32Array. 0x00102030
  511 +JsCrypto.Hex.parse("00102030").toString(); // "00102030"
  512 +```
  513 +
  514 +<h4 id='latin1'>Latin1</h4>
  515 +
  516 +```js
  517 + var w = new JsCrypto.Word32Array([0x616263ff]);
  518 +
  519 +// Latin1.stringify
  520 +JsCrypto.Latin1.stringify(w); // "abcÿ"
  521 +// or
  522 +w.toString(JsCrypto.Latin1); // "abcÿ"
  523 +
  524 +// Latin1.parse
  525 +JsCrypto.Latin1.parse("abcÿ"); // Word32Array. 0x616263ff
  526 +JsCrypto.Latin1.parse("abcÿ").toString(); // "616263ff"
  527 +```
  528 +
  529 +<h4 id='utf8'>UTF-8</h4>
  530 +
  531 +```js
  532 + var w = new JsCrypto.Word32Array([0xe3818200 | 0x00000061]); // e3-81-82 -> あ, 61 -> a
  533 +
  534 +// Utf8.stringify
  535 +JsCrypto.Utf8.stringify(w); // "あa"
  536 +// or
  537 +w.toString(JsCrypto.Utf8); // "あa"
  538 +
  539 +// Outside utf-8 code space cannot be stringified
  540 +JsCrypto.Utf8.stringify(new JsCrypto.Word32Array([0x00aabbcc])); // Uncaught Error: Malformed UTF-8 data
  541 +
  542 +// Utf8.parse
  543 +JsCrypto.Utf8.parse("あa"); // Word32Array. 0xe3818261
  544 +JsCrypto.Utf8.parse("あa").toString(); // "e3818261"
  545 +```
  546 +
  547 +<h4 id='utf16'>UTF-16</h4>
  548 +
  549 +```js
  550 +var w = new JsCrypto.Word32Array([0x30423044]); // 0x3042 = あ, 0x3044 = い in UTF-16
  551 +
  552 +// Utf16.stringify
  553 +JsCrypto.Utf16.stringify(w); // "あい"
  554 +// or
  555 +w.toString(JsCrypto.Utf16); // "あい"
  556 +
  557 +// Utf16.parse
  558 +JsCrypto.Utf16.parse("あい"); // Word32Array. 0x30423044
  559 +JsCrypto.Utf16.parse("あい").toString(); // "30423044"
  560 +```
  561 +
  562 +### Stream Cipher
  563 +<h4 id='rabbits'>Rabbits</h4>
  564 +
  565 +```js
  566 +// Encrypt
  567 +var message = JsCrypto.Hex.parse("00000000000000000000000000000000");
  568 +var key = JsCrypto.Hex.parse("00000000000000000000000000000000");
  569 +var encrypted = JsCrypto.Rabbit.encrypt(message, key).toString(); // "AvdKHCZFa/Xs1qU28FRXsQ=="
  570 +// Decrypt
  571 +var word = JsCrypto.Rabbit.decrypt(encrypted, key);
  572 +word.toString(); // "00000000000000000000000000000000"
  573 +```
  574 +
  575 +<h4 id='rc4'>RC4</h4>
  576 +
  577 +```js
  578 +// Encrypt
  579 +var message = JsCrypto.Hex.parse("0000000000000000"); // word32array
  580 +var key = JsCrypto.Hex.parse("0123456789abcdef"); // word32array
  581 +var encrypted = JsCrypto.RC4.encrypt(message, key).toString(); // "AvdKHCZFa/Xs1qU28FRXsQ=="
  582 +// Decrypt
  583 +var word = JsCrypto.RC4.decrypt(encrypted, key);
  584 +word.toString(); // "0000000000000000"
  585 +```
  586 +
  587 +<h4 id='rc4drop'>RC4Drop</h4>
  588 +
  589 +```js
  590 +// Encrypt
  591 +var encrypted = JsCrypto.RC4Drop.encrypt("Message", "Secret Passphrase", { drop: 3072/4 });
  592 +// Decrypt
  593 +var decrypted = JsCrypto.RC4Drop.decrypt(encrypted, "Secret Passphrase", { drop: 3072/4 });
  594 +decrypted.toString(JsCrypto.Utf8); // "Message"
  595 +```
  596 +
  597 +### Key Derivation Function
  598 +<h4 id='opensslkdf'>OpenSSLKDF</h4>
  599 +
  600 +String password cannot be used to crypto modules as it is.
  601 +It is automatically converted to a byte array in a crypto module by key derivation function.
  602 +You can generate binary key with Key Derivation Function by yourself, as described here.
  603 +
  604 +```js
  605 +// OpenSSLKDF returns both key/iv.
  606 +var keySize = 256/32; // 256bit -> 32byte -> 8words
  607 +var ivSize = 128/32; // 128bit -> 16byte -> 4words
  608 +var salt = JsCrypto.Hex.parse("0a9d8620cf7219f1");
  609 +var derivedParams = JsCrypto.OpenSSLKDF.execute("password", keySize, ivSize, salt);
  610 +
  611 +// "50f32e0ec9408e02ff42364a52aac95c3694fc027256c6f488bf84b8e60effcd";
  612 +derivedParams.key.toString();
  613 +// "81381e39b94fd692dff7e2239a298cb6";
  614 +derivedParams.iv.toString();
  615 +// "0a9d8620cf7219f1"
  616 +derivedParams.salt.toString();
  617 +```
  618 +
  619 +<h4 id='evpkdf'>EvpKDF</h4>
  620 +
  621 +```js
  622 +// Generate 192bit key
  623 +// https://www.openssl.org/docs/man1.1.1/man3/EVP_BytesToKey.html
  624 +// Return value is Word32Array.
  625 +var keySize = 192/32; // 192bit -> 6 words
  626 +var key = EvpKDF.getKey("password", "saltsalt", {keySize: keySize});
  627 +```
  628 +
  629 +<h4 id='pbkdf2'>PBKDF2</h4>
  630 +
  631 +```js
  632 +// Generate 256bit key with 1200 iterations.
  633 +// Password-Based Key Derivation Function 2 algorithm.
  634 +// Return value is Word32Array.
  635 +var key = PBKDF2.getKey("password", "saltsalt", {keySize: 256/32, iterations: 1200});
  636 +```
  637 +
  638 +
  639 +### Block Cipher mode
  640 +<h4 id='cbc'>CBC</h4>
  641 +
  642 +[Cipher Block Chaining](https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_block_chaining_(CBC))
  643 +**\*CBC requires encrypting data size to be padded to multiple of block size.** (Default block size is 128bits = 16bytes = 4words).
  644 +This is the default Block cipher mode for AES/DES/Triple-DES.
  645 +```js
  646 +var message = JsCrypto.Utf8.parse("message"); // 7bytes. Padding is required.
  647 +var key = new JsCrypto.Word32Array([0x20212223, 0x24252627, 0x28292a2b, 0x2c2d2e2f]);
  648 +var iv = new JsCrypto.Word32Array([0x30313233, 0x34353637, 0x38393a3b, 0x3c3d3e3f]);
  649 +
  650 +var CBC = JsCrypto.mode.CBC;
  651 +var Pkcs7 = JsCrypto.pad.Pkcs7; // Don't use 'JsCrypto.NoPadding' unless message size is multiple of 4 words.
  652 +var encrypted = JsCrypto.AES.encrypt(message, key, { iv: iv, mode: CBC, padding: Pkcs7 });
  653 +var decrypted = JsCrypto.AES.decrypt(encrypted, key, { iv: iv, mode: CBC, padding: Pkcs7 });
  654 +decrypted.toString(JsCrypto.Utf8); // "message"
  655 +
  656 +// If encrypting data is multiple of 16bytes, padding is not required.
  657 +var message = JsCrypto.Utf8.parse("encrypt--message"); // 16bytes. NoPadding is allowed.
  658 +var key = new JsCrypto.Word32Array([0x20212223, 0x24252627, 0x28292a2b, 0x2c2d2e2f]);
  659 +var iv = new JsCrypto.Word32Array([0x30313233, 0x34353637, 0x38393a3b, 0x3c3d3e3f]);
  660 +
  661 +var CBC = JsCrypto.mode.CBC;
  662 +var NoPadding = JsCrypto.pad.NoPadding;
  663 +var encrypted = JsCrypto.AES.encrypt(message, key, { iv: iv, mode: CBC, padding: NoPadding });
  664 +var decrypted = JsCrypto.AES.decrypt(encrypted, key, { iv: iv, mode: CBC, padding: NoPadding });
  665 +decrypted.toString(JsCrypto.Utf8); // "encrypt--message"
  666 +```
  667 +
  668 +<h4 id='cfb'>CFB</h4>
  669 +
  670 +[Cipher Feedback](https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_feedback_(CFB))
  671 +Unlike CBC, padding is not required.
  672 +```js
  673 +var message = JsCrypto.Utf8.parse("message"); // 7bytes.
  674 +var key = new JsCrypto.Word32Array([0x20212223, 0x24252627, 0x28292a2b, 0x2c2d2e2f]);
  675 +var iv = new JsCrypto.Word32Array([0x30313233, 0x34353637, 0x38393a3b, 0x3c3d3e3f]);
  676 +
  677 +var CFB = JsCrypto.mode.CFB;
  678 +var NoPadding = JsCrypto.pad.NoPadding;
  679 +var encrypted = JsCrypto.AES.encrypt(message, key, { iv: iv, mode: CFB, padding: NoPadding });
  680 +var decrypted = JsCrypto.AES.decrypt(encrypted, key, { iv: iv, mode: CFB, padding: NoPadding });
  681 +decrypted.toString(JsCrypto.Utf8); // "message"
  682 +```
  683 +
  684 +<h4 id='ctr'>CTR</h4>
  685 +
  686 +[Counter](https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Counter_(CTR))
  687 +This CTR mode does not require data to be padded.
  688 +```js
  689 +var message = JsCrypto.Utf8.parse("message"); // 7bytes.
  690 +var key = new JsCrypto.Word32Array([0x20212223, 0x24252627, 0x28292a2b, 0x2c2d2e2f]);
  691 +var iv = new JsCrypto.Word32Array([0x30313233, 0x34353637, 0x38393a3b, 0x3c3d3e3f]);
  692 +
  693 +var CTR = JsCrypto.mode.CTR;
  694 +var NoPadding = JsCrypto.pad.NoPadding;
  695 +var encrypted = JsCrypto.AES.encrypt(message, key, { iv: iv, mode: CTR, padding: NoPadding });
  696 +var decrypted = JsCrypto.AES.decrypt(encrypted, key, { iv: iv, mode: CTR, padding: NoPadding });
  697 +decrypted.toString(JsCrypto.Utf8); // "message"
  698 +```
  699 +
  700 +<h4 id='ecb'>ECB</h4>
  701 +
  702 +[Electronic Code Block](https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Electronic_codebook_(ECB))
  703 +The simplest of the encryption modes. **Padding is required as well as CBC**
  704 +Because ECB encrypts identical plaintext blocks into identical ciphertext blocks, it does not hide data patterns well.
  705 +ECB is not recommended for use in cryptographic protocols
  706 +```js
  707 +var message = JsCrypto.Utf8.parse("message"); // 7bytes. Padding is required.
  708 +var key = new JsCrypto.Word32Array([0x20212223, 0x24252627, 0x28292a2b, 0x2c2d2e2f]);
  709 +var iv = new JsCrypto.Word32Array([0x30313233, 0x34353637, 0x38393a3b, 0x3c3d3e3f]);
  710 +
  711 +var ECB = JsCrypto.mode.ECB;
  712 +var Pkcs7 = JsCrypto.pad.Pkcs7; // Don't use 'JsCrypto.NoPadding' unless message size is multiple of 4 words.
  713 +var encrypted = JsCrypto.AES.encrypt(message, key, { iv: iv, mode: ECB, padding: Pkcs7 });
  714 +var decrypted = JsCrypto.AES.decrypt(encrypted, key, { iv: iv, mode: ECB, padding: Pkcs7 });
  715 +decrypted.toString(JsCrypto.Utf8); // "message"
  716 +```
  717 +
  718 +<h4 id='ofb'>OFB</h4>
  719 +
  720 +[Output Feedback](https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Output_feedback_(OFB))
  721 +OFB does not require encrypting data to be padded.
  722 +```js
  723 +var message = JsCrypto.Utf8.parse("message"); // 7bytes.
  724 +var key = new JsCrypto.Word32Array([0x20212223, 0x24252627, 0x28292a2b, 0x2c2d2e2f]);
  725 +var iv = new JsCrypto.Word32Array([0x30313233, 0x34353637, 0x38393a3b, 0x3c3d3e3f]);
  726 +
  727 +var OFB = JsCrypto.mode.OFB;
  728 +var NoPadding = JsCrypto.pad.NoPadding;
  729 +var encrypted = JsCrypto.AES.encrypt(message, key, { iv: iv, mode: OFB, padding: NoPadding });
  730 +var decrypted = JsCrypto.AES.decrypt(encrypted, key, { iv: iv, mode: OFB, padding: NoPadding });
  731 +decrypted.toString(JsCrypto.Utf8); // "message"
  732 +```
  733 +
  734 +<h4 id="gcm">GCM</h4>
  735 +
  736 +[Galois Counter Mode](https://en.wikipedia.org/wiki/Galois/Counter_Mode) for authenticated encryption.
  737 +
  738 +GCM does not require encrypting data to be padded.
  739 +Changing Block padding has no effect.
  740 +
  741 +For detailed specification, please read official NIST publication.
  742 +https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
  743 +
  744 +```js
  745 +////////////////////////////////////////////////////////////////////////////////////////
  746 +// Authenticated encryption by AES-GCM
  747 +////////////////////////////////////////////////////////////////////////////////////////
  748 +var key = JsCrypto.Hex.parse("0123456789ABCDEF11113333555577770123456789ABCDEF1111333355557777");
  749 +var msg = JsCrypto.Hex.parse("00000000000000000000000000000000");
  750 +var iv = JsCrypto.Hex.parse("000000000000000000000000"); // 96bit(12byte) iv is recommended.
  751 +var authData = JsCrypto.Utf8.parse("some plain text data for authentication. This will not be encrypted.");
  752 +
  753 +var encryptedData = JsCrypto.AES.encrypt(msg, key, {iv, mode: JsCrypto.mode.GCM});
  754 +
  755 +// Encrypted message
  756 +var cipherText = encryptedData.cipherText;
  757 +// Authentication Tag
  758 +// 16byte. Output tag length in byte. If you omit this option, default value 16 is used.
  759 +var tagLength = 16;
  760 +var authTag = JsCrypto.mode.GCM.mac(JsCrypto.AES, key, iv, authData, cipherText, tagLength);
  761 +
  762 +// Base64 encoded encrypted data which can be safely shared in public.
  763 +// DO NOT share original `encryptedData` itself without calling `toString()`.
  764 +// Original encrypteData object contains key data, so if you share encryptedData variable in public,
  765 +// it turns to be just a plain text.
  766 +var encryptedPayload = encryptedData.toString();
  767 +
  768 +////////////////////////////////////////////////////////////////////////////////////////
  769 +// Authenticated decryption by AES-GCM
  770 +////////////////////////////////////////////////////////////////////////////////////////
  771 +// Decrypting entity receives encryptedPayload, iv, authData. key should be share previously.
  772 +var decryptedData = JsCrypto.AES.decrypt(encryptedPayload, key, {iv, mode: JsCrypto.mode.GCM});
  773 +
  774 +// Encrypt/Decrypt as usual
  775 +decryptedData.toString() === msg.toString(); // true
  776 +
  777 +// Verify authentication code as well as HMAC
  778 +var cipherText = JsCrypto.formatter.OpenSSLFormatter.parse(encryptedPayload).cipherText;
  779 +// authTag, iv, authData, cipherText(encryptedPayload) may be shared in public.
  780 +// key should be pre-shared in private.
  781 +authTag.toString() === JsCrypto.mode.GCM.mac(JsCrypto.AES, key, iv, authData, cipherText).toString(); // true
  782 +```
  783 +
  784 +<h4 id="ccm">CCM</h4>
  785 +
  786 +[CCM Mode](https://en.wikipedia.org/wiki/CCM_mode) for authenticated encryption.
  787 +
  788 +For detailed specification, please read official NIST publication.
  789 +https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38c.pdf
  790 +
  791 +```js
  792 +// Example test vectors
  793 +// See page 17 at https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38c.pdf
  794 +// Klen=128bit, Tlen=32bit, Nlen=56bit, Alen=64bit, Plen=32bit
  795 +var K = JsCrypto.Hex.parse("404142434445464748494a4b4c4d4e4f"); // key
  796 +var N = JsCrypto.Hex.parse("10111213141516"); // Nonce/iv
  797 +var A = JsCrypto.Hex.parse("0001020304050607"); // Associated Data
  798 +var P = JsCrypto.Hex.parse("20212223"); // Payload/Plaintext
  799 +var t = 32/8; // 4byte. tag length byte.
  800 +
  801 +// Generate CBC-MAC
  802 +var cbcMac = JsCrypto.mode.CCM.mac(JsCrypto.AES, K, N, A, P, t);
  803 +cbcMac.toString(); // "4dac255d"
  804 +
  805 +// Encryption
  806 +var encrypted = JsCrypto.AES.encrypt(P, K, { iv: N, mode: JsCrypto.mode.CCM, padding: JsCrypto.pad.NoPadding });
  807 +var cipherText = encrypted.cipherText;
  808 +cipherText.toString(); // "7162015b"
  809 +
  810 +// Combine encrypted block and MAC to be compatible with cipher output at Steps 8 in chapter 6.1, NIST-800-38C.
  811 +// See page 9 through page 10 at https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38c.pdf
  812 +var nist80038cStyleCiphertext = JsCrypto.mode.CCM.combineCipherTextAndAuthTag(cipherText, cbcMac);
  813 +nist80038cStyleCiphertext.toString(); // "7162015b4dac255d"
  814 +
  815 +// Decryption
  816 +// Assuming you receive nist 800-38c style ciphertext and N, A, P, t from encrypting entity.
  817 +// K(key) should be pre-shared privately.
  818 +var cipherTextAndAuthTag = JsCrypto.mode.CCM.splitCipherTextAndAuthTag(nist80038cStyleCiphertext, t);
  819 +var cipherText = cipherTextAndAuthTag.cipherText;
  820 +var authTag = cipherTextAndAuthTag.authTag;
  821 +var cp = new JsCrypto.CipherParams({cipherText});
  822 +// Finally decrypt here
  823 +var decrypted = JsCrypto.AES.decrypt(cp, K, {iv: N, mode: JsCrypto.mode.CCM, padding: JsCrypto.pad.NoPadding});
  824 +decrypted.toString() === P.toString(); // true
  825 +authTag.toString() === cbcMac.toString(); // true
  826 +```
  827 +
  828 +<h5 id="note-for-ccm-implementation">Note for CCM implementation</h5>
  829 +
  830 +Since there are many CCM implementations out in the world, interoperability among those implementations can't be expected.
  831 +I can only say that CCM implementation of `jscrypto` follows NIST 800-38C style ciphertext.
  832 +
  833 +However, since I put an emphasis on coherence on this library,
  834 +jscrypto requires you to take additional steps to reproduce exact the same cipher output as NIST 800-38C style ciphertext.
  835 +
  836 +- JsCrypto's CCM independently outputs ciphertext and authTag(mac).
  837 + Each operation(encryption/generating mac) does not care opponent's internal state at all.
  838 +- If you want to generate NIST 800-38C style ciphertext, you need to take steps as below.
  839 + 1. encrypt plain text
  840 + 2. generate CBC-MAC
  841 + 3. combine outputs from above operations.
  842 +
  843 +![](./docs/how-jscrypto-CCM-handles-ciphertext.png)
  844 +
  845 +<h5 id="reason-why-it-takes-extra-steps-in-ccm">The reason why it takes extra steps</h5>
  846 +
  847 +You may notice that in NIST 800-38C style ciphertext, sizes of input plaintext and output ciphertext does not match
  848 +because 800-38C's ciphertext is followed by MAC of input data(a.k.a. authTag). So size of output ciphertext is size of plaintext plus size of MAC(authTag).
  849 +
  850 +In `jscrypto`, block cipher takes fixed size block and produces the same size block and repeats it
  851 +until all blocks which compose of input plaintext are consumed.
  852 +Even CCM is not an exception. CCM takes fixed size block and produce the same size encrypted block.
  853 +So if you want NIST 800-38C style ciphertext, you need to combine encrypted plaintext and MAC.
  854 +
  855 +### Block Padding
  856 +<h4 id='ansix923'>AnsiX923</h4>
  857 +
  858 +Add 0 and number of bytes added.
  859 +
  860 +```js
  861 +var data = new JsCrypto.Word32Array([0xaabbcc00], 3); // 3bytes
  862 +// pad(data, blockSizeInWords)
  863 +JsCrypto.pad.AnsiX923.pad(data, 2); // Padding to 2words * 4bytes/words = 8bytes
  864 +
  865 +// true
  866 +data.toString(); // aabbcc0000000005
  867 +
  868 +// new JsCrypto.Word32Array([0xaabbcc00, 0x00000005])
  869 +// ^^ ^^^^^^^^
  870 +// ^: Bytes added by padding. Last byte represents number of bytes added.
  871 +//
  872 +// AnsiX923 requires padding value to be zero. (https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.paddingmode?view=net-5.0)
  873 +// Note that IBM said padding value is to be random. (https://www.ibm.com/support/knowledgecenter/en/linuxonibm/com.ibm.linux.z.wskc.doc/wskc_c_l0wskc58.html)
  874 +
  875 +JsCrypto.pad.AnsiX923.unpad(data);
  876 +// true
  877 +data.toString(); // aabbcc
  878 +```
  879 +
  880 +<h4 id='iso10126'>ISO10126</h4>
  881 +
  882 +Add random bytes and number of bytes added.
  883 +
  884 +```js
  885 +var data = new JsCrypto.Word32Array([0xaabbcc00], 3);
  886 +// pad(data, blockSizeInWords)
  887 +JsCrypto.pad.ISO10126.pad(data, 2);
  888 +// Padding strategy is almost the same with ANSIX9.23. The difference is padded value.
  889 +// Padded values in AnsiX9.23 is 0 while ISO10126 is random.
  890 +
  891 +data.toString(); // aabbccf6b9304505, where f6b9304505 is added. Last byte(5) means 5 bytes have been added. Other padded values are random.
  892 +
  893 +JsCrypto.pad.ISO10126.unpad(data);
  894 +// true
  895 +data.toString(); // aabbcc
  896 +```
  897 +
  898 +<h4 id='iso97971'>ISO97971</h4>
  899 +
  900 +Add 0x80 and 0s.
  901 +
  902 +```js
  903 +var data = new JsCrypto.Word32Array([0xaabbccdd, 0xee000000], 5);
  904 +// pad(data, blockSizeInWords)
  905 +JsCrypto.pad.ISO97971.pad(data, 2);
  906 +
  907 +data.toString(); // aabbccddee800000, where 800000 is added. Always add 0x80 and following 0 until last byte.
  908 +
  909 +JsCrypto.pad.ISO97971.unpad(data);
  910 +// true
  911 +data.toString(); // aabbccddee
  912 +
  913 +```
  914 +
  915 +<h4 id='nopadding'>NoPadding</h4>
  916 +
  917 +As name says, it pretends to pad.
  918 +```js
  919 +var data = new JsCrypto.Word32Array([0xaabbccdd, 0xee000000], 5);
  920 +// pad(data, blockSizeInWords)
  921 +JsCrypto.pad.NoPadding.pad(data, 2);
  922 +
  923 +data.toString(); // aabbccddee. Not padding at all.
  924 +
  925 +JsCrypto.pad.NoPadding.unpad(data);
  926 +// true
  927 +data.toString(); // aabbccddee
  928 +```
  929 +
  930 +<h4 id='pkcs7'>Pkcs7</h4>
  931 +
  932 +The value of each added byte is the number of bytes that are added
  933 +```js
  934 +var data = new JsCrypto.Word32Array([0xaabbccdd, 0xee000000], 5);
  935 +// pad(data, blockSizeInWords)
  936 +JsCrypto.pad.Pkcs7.pad(data, 2);
  937 +
  938 +data.toString(); // aabbccddee030303
  939 +
  940 +JsCrypto.pad.Pkcs7.unpad(data);
  941 +// true
  942 +data.toString(); // aabbccddee
  943 +```
  944 +
  945 +<h4 id='zero'>Zero</h4>
  946 +
  947 +The value of each added byte is 0.
  948 +Note Zero padding may not be reversible if the original file ends with one or more zero bytes.
  949 +```js
  950 +var data = new JsCrypto.Word32Array([0xaabbccdd, 0xee000000], 5);
  951 +// pad(data, blockSizeInWords)
  952 +JsCrypto.pad.Zero.pad(data, 2);
  953 +
  954 +data.toString(); // aabbccddee000000
  955 +
  956 +JsCrypto.pad.Zero.unpad(data);
  957 +// true
  958 +data.toString(); // aabbccddee
  959 +```
  960 +
  961 +### Formatter
  962 +<h4 id='opensslformatter'>OpenSSLFormatter</h4>
  963 +
  964 +Converts a cipher params object to an OpenSSL-compatible string which contains encrypted data and kdf salt.
  965 +
  966 +Encrypt by JsCrypto
  967 +```js
  968 +// CBC/ECB/CTR/OFB/CFB is the options
  969 +var mode = JsCrypto.mode.CBC;
  970 +// AnsiX923/ISO10126/ISO97971/Pkcs7/NoPadding/Zero is the options
  971 +var padding = JsCrypto.pad.Pkcs7;
  972 +// AnsiX923/ISO10126/ISO97971/Pkcs7/NoPadding/Zero is the options
  973 +var kdfModule = JsCrypto.PBKDF2;
  974 +// MD5/SHA1/SHA3/SHA225/SHA256/SHA384/SHA512/RIPEMD160 is the options
  975 +var kdfHasher = JsCrypto.SHA256;
  976 +// 10000 is the default value. You can omit this.
  977 +var kdfIterations = 10000;
  978 +// For testing purpose only. DO NOT USE salt unless you need it.
  979 +var kdfSalt = JsCrypto.Hex.parse("daefe2565e3c4680");
  980 +var aesProps = {mode, padding, kdfModule, kdfSalt, kdfHasher, kdfIterations};
  981 +
  982 +var cipherParams = JsCrypto.AES.encrypt("message", "password", aesProps);
  983 +// Gets "U2FsdGVkX1/a7+JWXjxGgCXR5T2J97jwBZAKtZNXZI4=". OpenSSL compatible format.
  984 +JsCrypto.formatter.OpenSSLFormatter.stringify(cipherParams);
  985 +// Or
  986 +cipherParams.toString();
  987 +
  988 +// You can omit default parameters.
  989 +var cipherParams = JsCrypto.AES.encrypt("message", "password", {kdfSalt: JsCrypto.Hex.parse("daefe2565e3c4680")});
  990 +// "U2FsdGVkX1/a7+JWXjxGgCXR5T2J97jwBZAKtZNXZI4=". OpenSSL compatible format.
  991 +cipherParams.toString();
  992 +// Above options are all default values except for kdfSalt so you can omit them if you want to use default values.
  993 +// Warning: DO NOT specify kdfSalt unless you need to do it.
  994 +```
  995 +
  996 +Equivalent in OpenSSL (OpenSSL 1.1.1f)
  997 +```shell
  998 +echo -n "message" | openssl enc -e -aes-256-cbc -pass pass:password -base64 -pbkdf2 -S daefe2565e3c4680 -iter 10000
  999 +# Output: U2FsdGVkX1/a7+JWXjxGgCXR5T2J97jwBZAKtZNXZI4=
  1000 +
  1001 +# or simply
  1002 +echo -n "message" | openssl enc -e -aes-256-cbc -pass pass:password -base64 -S daefe2565e3c4680
  1003 +# pbkdf2 and iterations:10000 is the default value in OpenSSL 1.1.1f
  1004 +```
  1005 +
  1006 +Decrypt by JsCrypto
  1007 +```js
  1008 +var mode = JsCrypto.mode.CBC;
  1009 +var padding = JsCrypto.pad.Pkcs7;
  1010 +var kdfModule = JsCrypto.PBKDF2;
  1011 +var kdfHasher = JsCrypto.SHA256;
  1012 +var kdfIterations = 10000;
  1013 +var kdfSalt = JsCrypto.Hex.parse("daefe2565e3c4680");
  1014 +var aesProps = {mode, padding, kdfModule, kdfSalt, kdfHasher, kdfIterations};
  1015 +
  1016 +var encryptedData = "U2FsdGVkX1/a7+JWXjxGgCXR5T2J97jwBZAKtZNXZI4=";
  1017 +var decrypted = JsCrypto.AES.decrypt(encryptedData, "password", aesProps);
  1018 +decrypted.toString(JsCrypto.Utf8); // "message"
  1019 +```
  1020 +
  1021 +In OpenSSL
  1022 +```shell
  1023 +echo "U2FsdGVkX1/a7+JWXjxGgCXR5T2J97jwBZAKtZNXZI4=" | openssl enc -d -aes-256-cbc -pass pass:password -base64 -pbkdf2 -S daefe2565e3c4680 -iter 10000
  1024 +# Output: message (Without newline)
  1025 +```
  1026 +
  1027 +[MD5]: #md5
  1028 +[SHA1]: #sha1
  1029 +[SHA3]: #sha3
  1030 +[SHA224]: #sha224
  1031 +[SHA256]: #sha256
  1032 +[SHA384]: #sha384
  1033 +[SHA512]: #sha512
  1034 +[RIPEMD160]: #ripemd160
  1035 +[HMAC-MD5]: #hmac-md5
  1036 +[HMAC-SHA224]: #hmac-sha224
  1037 +[HMAC-SHA256]: #hmac-sha256
  1038 +[HMAC-SHA384]: #hmac-sha384
  1039 +[HMAC-SHA512]: #hmac-sha512
  1040 +[GMAC]: #gmac
  1041 +[CBC-MAC]: #cbc-mac
  1042 +[AES]: #aes
  1043 +[DES]: #des
  1044 +[Triple-DES]: #des3
  1045 +[Word32Array]: #word32array
  1046 +[Word64Array]: #mword64Array
  1047 +[Base64]: #base64
  1048 +[Hex]: #hex
  1049 +[Latin1]: #latin1
  1050 +[Utf8]: #utf8
  1051 +[Utf16]: #utf16
  1052 +[Rabbits]: #rabbits
  1053 +[RC4]: #rc4
  1054 +[RC4Drop]: #rc4drop
  1055 +[OpenSSLKDF]: #opensslkdf
  1056 +[EvpKDF]: #evpkdf
  1057 +[PBKDF2]: #pbkdf2
  1058 +[CBC]: #cbc
  1059 +[CFB]: #cfb
  1060 +[CTR]: #ctr
  1061 +[ECB]: #ecb
  1062 +[OFB]: #ofb
  1063 +[GCM]: #gcm
  1064 +[CCM]: #ccm
  1065 +[AnsiX923]: #ansix923
  1066 +[ISO10126]: #iso10126
  1067 +[ISO97971]: #iso97971
  1068 +[NoPadding]: #nopadding
  1069 +[Pkcs7]: #pkcs7
  1070 +[Zero]: #zero
  1071 +[OpenSSLFormatter]: #opensslformatter
... ...
  1 +export { Base64 } from "./lib/encoder/Base64";
... ...
  1 +!function(r,n){if("object"==typeof exports&&"object"==typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else if("object"==typeof exports)exports.JsCrypto=n();else{var t=n();for(var e in r.JsCrypto=r.JsCrypto||{},t)r.JsCrypto[e]=t[e]}}(this,(function(){return function(){"use strict";var r={d:function(n,t){for(var e in t)r.o(t,e)&&!r.o(n,e)&&Object.defineProperty(n,e,{enumerable:!0,get:t[e]})}};r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(r){if("object"==typeof window)return window}}(),r.o=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)},r.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"t",{value:!0})};var n={};r.r(n),r.d(n,{Base64:function(){return h}});var t,e=function(r){for(var n=r.nSigBytes,t=r.words,e=[],i=0;i<n;i++){var o=t[i>>>2]>>>24-i%4*8&255;e.push((o>>>4).toString(16)),e.push((15&o).toString(16))}return e.join("")},i="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(t=parseInt((/msie (\d+)/.exec(i)||[])[1],10),isNaN(t)?(t=parseInt((/trident\/.*; rv:(\d+)/.exec(i)||[])[1],10),!isNaN(t)&&t):t);for(var a=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if(function(r,n){return!1!==o&&(!n||("<"===r?o<n:"<="===r?o<=n:">"===r?o>n:">="===r?o>=n:o===n))}("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}(),f=function(){function r(n,t){if(Array.isArray(n)||!n)return this.i=Array.isArray(n)?n:[],void(this.u="number"==typeof t?t:4*this.i.length);if(n instanceof r)return this.i=n.words.slice(),void(this.u=n.nSigBytes);var e;try{n instanceof ArrayBuffer?e=new Uint8Array(n):(n instanceof Uint8Array||n instanceof Int8Array||n instanceof Uint8ClampedArray||n instanceof Int16Array||n instanceof Uint16Array||n instanceof Int32Array||n instanceof Uint32Array||n instanceof Float32Array||n instanceof Float64Array)&&(e=new Uint8Array(n.buffer,n.byteOffset,n.byteLength))}catch(r){throw new Error("Invalid argument")}if(!e)throw new Error("Invalid argument");for(var i=e.byteLength,o=[],a=0;a<i;a++)o[a>>>2]|=e[a]<<24-a%4*8;this.i=o,this.u=i}return Object.defineProperty(r.prototype,"nSigBytes",{get:function(){return this.u},set:function(r){this.u=r},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"words",{get:function(){return this.i},enumerable:!1,configurable:!0}),r.prototype.toString=function(r){return r?r.stringify(this):e(this)},r.prototype.toUint8Array=function(){for(var r=this.i,n=this.u,t=new Uint8Array(n),e=0;e<n;e++)t[e]=r[e>>>2]>>>24-e%4*8&255;return t},r.prototype.concat=function(r){var n=r.words.slice(),t=r.nSigBytes;if(this.clamp(),this.u%4)for(var e=0;e<t;e++){var i=n[e>>>2]>>>24-e%4*8&255;this.i[this.u+e>>>2]|=i<<24-(this.u+e)%4*8}else for(e=0;e<t;e+=4)this.i[this.u+e>>>2]=n[e>>>2];return this.u+=t,this},r.prototype.clamp=function(){var r=this.u;this.i[r>>>2]&=4294967295<<32-r%4*8,this.i.length=Math.ceil(r/4)},r.prototype.clone=function(){return new r(this.i.slice(),this.u)},r.random=function(n){for(var t=[],e=0;e<n;e+=4)t.push(a());return new r(t,n)},r}(),u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s=[],c=0;c<u.length;c++)s[u.charCodeAt(c)]=c;var h={stringify:function(r){var n=r.words,t=r.nSigBytes;r.clamp();for(var e=[],i=0;i<t;i+=3)for(var o=(n[i>>>2]>>>24-i%4*8&255)<<16|(n[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|n[i+2>>>2]>>>24-(i+2)%4*8&255,a=0;a<4&&i+.75*a<t;a++)e.push(u.charAt(o>>>6*(3-a)&63));var f=u.charAt(64);if(f)for(;e.length%4;)e.push(f);return e.join("")},parse:function(r){var n=r.length,t=u.charAt(64);if(t){var e=r.indexOf(t);-1!==e&&(n=e)}for(var i=[],o=0,a=0;a<n;a++)if(a%4){var c=s[r.charCodeAt(a-1)]<<a%4*2|s[r.charCodeAt(a)]>>>6-a%4*2;i[o>>>2]|=c<<24-o%4*8,o++}return new f(i,o)}};return n}()}));
\ No newline at end of file
... ...
  1 +import { Word32Array } from "./lib/Word32Array";
  2 +import { BlockCipher } from "./lib/algorithm/cipher/BlockCipher";
  3 +export declare type CBCMACProps = {
  4 + Cipher: typeof BlockCipher;
  5 +};
  6 +export declare function CBCMAC(plainText: Word32Array | string, associatedData: Word32Array | string, key: Word32Array | string, iv: Word32Array | null, tagLength?: number, props?: Partial<CBCMACProps>): Word32Array;
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var i in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[i]=r[i]}}(this,(function(){return function(){"use strict";var n={9691:function(n,t,r){r.d(t,{AES:function(){return g}});var i,e=r(9456),o=r(787),u=r(5693),f=r(9109),c=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),s=function(){return(s=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},a=[],h=[],v=[],w=[],l=[],d=[],b=[],y=[],p=[],m=[];!function(){for(var n=[],t=0;t<256;t++)n[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var e=i^i<<1^i<<2^i<<3^i<<4;e=e>>>8^255&e^99,a[r]=e,h[e]=r;var o=n[r],u=n[o],f=n[u],c=257*n[e]^16843008*e;v[r]=c<<24|c>>>8,w[r]=c<<16|c>>>16,l[r]=c<<8|c>>>24,d[r]=c,c=16843009*f^65537*u^257*o^16843008*r,b[e]=c<<24|c>>>8,y[e]=c<<16|c>>>16,p[e]=c<<8|c>>>24,m[e]=c,r?(r=o^n[n[n[f^o]]],i^=n[n[i]]):r=i=1}}();var j=[0,1,2,4,8,16,32,64,128,27,54],g=function(n){function t(t){var r=n.call(this,t)||this;return r.i=0,r.u=[],r.h=[],r.v=t,r.j(),r}return c(t,n),t.prototype.j=function(){var n;if(!this.i||this.O!==this.A){for(var t=this.O=this.A,r=t.words,i=t.nSigBytes/4,e=4*((this.i=i+6)+1),o=this.u=[],u=0;u<e;u++)u<i?o[u]=r[u]:(n=o[u-1],u%i?i>6&&u%i==4&&(n=a[n>>>24]<<24|a[n>>>16&255]<<16|a[n>>>8&255]<<8|a[255&n]):(n=a[(n=n<<8|n>>>24)>>>24]<<24|a[n>>>16&255]<<16|a[n>>>8&255]<<8|a[255&n],n^=j[u/i|0]<<24),o[u]=o[u-i]^n);this.h=[];for(var f=0;f<e;f++){u=e-f;n=f%4?o[u]:o[u-4],this.h[f]=f<4||u<=4?n:b[a[n>>>24]]^y[a[n>>>16&255]]^p[a[n>>>8&255]]^m[a[255&n]]}}},t.prototype.encryptBlock=function(n,t){this.N(n,t,this.u,v,w,l,d,a)},t.prototype.decryptBlock=function(n,t){var r=n[t+1];n[t+1]=n[t+3],n[t+3]=r,this.N(n,t,this.h,b,y,p,m,h),r=n[t+1],n[t+1]=n[t+3],n[t+3]=r},t.prototype.N=function(n,t,r,i,e,o,u,f){for(var c=this.i,s=n[t]^r[0],a=n[t+1]^r[1],h=n[t+2]^r[2],v=n[t+3]^r[3],w=4,l=1;l<c;l++){var d=i[s>>>24]^e[a>>>16&255]^o[h>>>8&255]^u[255&v]^r[w++],b=i[a>>>24]^e[h>>>16&255]^o[v>>>8&255]^u[255&s]^r[w++],y=i[h>>>24]^e[v>>>16&255]^o[s>>>8&255]^u[255&a]^r[w++],p=i[v>>>24]^e[s>>>16&255]^o[a>>>8&255]^u[255&h]^r[w++];s=d,a=b,h=y,v=p}var m=(f[s>>>24]<<24|f[a>>>16&255]<<16|f[h>>>8&255]<<8|f[255&v])^r[w++],j=(f[a>>>24]<<24|f[h>>>16&255]<<16|f[v>>>8&255]<<8|f[255&s])^r[w++],g=(f[h>>>24]<<24|f[v>>>16&255]<<16|f[s>>>8&255]<<8|f[255&a])^r[w++],O=(f[v>>>24]<<24|f[s>>>16&255]<<16|f[a>>>8&255]<<8|f[255&h])^r[w++];n[t]=m,n[t+1]=j,n[t+2]=g,n[t+3]=O},t.createEncryptor=function(n,r){return new t(s(s({},r=void 0===r?{}:r),{key:n,transformMode:e.t.ENC_TRANSFORM_MODE}))},t.createDecryptor=function(n,r){return new t(s(s({},r=void 0===r?{}:r),{key:n,transformMode:e.t.DEC_TRANSFORM_MODE}))},t.encrypt=function(n,r,i){if("string"==typeof r)return u.E.encrypt(t,n,r,i);if(r.nSigBytes%4!=0)throw new Error("Key size must be multiple of 32bit/4byte/1word");return f.D.encrypt(t,n,r,i)},t.decrypt=function(n,r,i){if("string"==typeof r)return u.E.decrypt(t,n,r,i);if(r.nSigBytes%4!=0)throw new Error("Key size must be multiple of 32bit/4byte/1word");return f.D.decrypt(t,n,r,i)},t.keySize=8,t}(o.G)},6367:function(n,t,r){r.d(t,{Hmac:function(){return e}});var i=r(4768),e=function(){function n(n,t){this.k=n,"string"==typeof t&&(t=i.d.parse(t));var r=n.blockSize,e=4*r;t.nSigBytes>e&&(t=n.finalize(t)),t.clamp();for(var o=this.I=t.clone(),u=this.S=t.clone(),f=o.words,c=u.words,s=0;s<r;s++)f[s]^=1549556828,c[s]^=909522486;u.nSigBytes=e,o.nSigBytes=e,this.reset()}return n.prototype.reset=function(){this.k.reset(),this.k.update(this.S)},n.prototype.update=function(n){return this.k.update(n),this},n.prototype.finalize=function(n){var t=this.k.finalize(n);return this.k.reset(),this.k.finalize(this.I.clone().concat(t))},n}()},5561:function(n,t,r){r.d(t,{SHA256:function(){return v}});var i,e=r(1868),o=r(3354),u=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),f=[],c=[];function s(n){for(var t=Math.sqrt(n),r=2;r<=t;r++)if(!(n%r))return!1;return!0}function a(n){return 4294967296*(n-(0|n))|0}!function(){for(var n=2,t=0;t<64;)s(n)&&(t<8&&(f[t]=a(Math.pow(n,.5))),c[t]=a(Math.pow(n,1/3)),t++),n++}();var h=[],v=function(n){function t(t){var r=n.call(this,t)||this;return r.U=new o.e(f.slice(0)),r.v=t,t&&void 0!==t.hash&&(r.U=t.hash.clone()),r}return u(t,n),t.prototype.j=function(){this.U=new o.e(f.slice(0))},t.prototype.B=function(n,t){for(var r=this.U.words,i=r[0],e=r[1],o=r[2],u=r[3],f=r[4],s=r[5],a=r[6],v=r[7],w=0;w<64;w++){if(w<16)h[w]=0|n[t+w];else{var l=h[w-15],d=(l<<25|l>>>7)^(l<<14|l>>>18)^l>>>3,b=h[w-2],y=(b<<15|b>>>17)^(b<<13|b>>>19)^b>>>10;h[w]=d+h[w-7]+y+h[w-16]}var p=i&e^i&o^e&o,m=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),j=v+((f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25))+(f&s^~f&a)+c[w]+h[w];v=a,a=s,s=f,f=u+j|0,u=o,o=e,e=i,i=j+(m+p)|0}r[0]=r[0]+i|0,r[1]=r[1]+e|0,r[2]=r[2]+o|0,r[3]=r[3]+u|0,r[4]=r[4]+f|0,r[5]=r[5]+s|0,r[6]=r[6]+a|0,r[7]=r[7]+v|0},t.prototype.F=function(){var n=this.H.words,t=8*this.L,r=8*this.H.nSigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=Math.floor(t/4294967296),n[15+(r+64>>>9<<4)]=t,this.H.nSigBytes=4*n.length,this.R(),this.U},t.prototype.clone=function(){return new t({hash:this.U,blockSize:this.q,data:this.H,nBytes:this.L})},t.hash=function(n,r){return new t(r).finalize(n)},t}(e.P)},3354:function(n,t,r){r.d(t,{e:function(){return o}});var i=r(5720),e=r(9054),o=function(){function n(t,r){if(Array.isArray(t)||!t)return this.J=Array.isArray(t)?t:[],void(this.V="number"==typeof r?r:4*this.J.length);if(t instanceof n)return this.J=t.words.slice(),void(this.V=t.nSigBytes);var i;try{t instanceof ArrayBuffer?i=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!i)throw new Error("Invalid argument");for(var e=i.byteLength,o=[],u=0;u<e;u++)o[u>>>2]|=i[u]<<24-u%4*8;this.J=o,this.V=e}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.V},set:function(n){this.V=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.J},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):i.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.J,t=this.V,r=new Uint8Array(t),i=0;i<t;i++)r[i]=n[i>>>2]>>>24-i%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.V%4)for(var i=0;i<r;i++){var e=t[i>>>2]>>>24-i%4*8&255;this.J[this.V+i>>>2]|=e<<24-(this.V+i)%4*8}else for(i=0;i<r;i+=4)this.J[this.V+i>>>2]=t[i>>>2];return this.V+=r,this},n.prototype.clamp=function(){var n=this.V;this.J[n>>>2]&=4294967295<<32-n%4*8,this.J.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.J.slice(),this.V)},n.random=function(t){for(var r=[],i=0;i<t;i+=4)r.push((0,e.M)());return new n(r,t)},n}()},7211:function(n,t,r){r.d(t,{C:function(){return o}});var i=r(3354),e=r(4768),o=function(){function n(n){this.X=0,this.q=0,this.v=n,this.H=n&&void 0!==n.data?n.data.clone():new i.e,this.L=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.q},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.H=void 0!==n?n.clone():new i.e,this.L="number"==typeof t?t:0},n.prototype.Y=function(n){var t="string"==typeof n?e.d.parse(n):n;this.H.concat(t),this.L+=t.nSigBytes},n.prototype.R=function(n){var t,r=this.H.words,e=this.H.nSigBytes,o=this.q,u=e/(4*this.q),f=(u=n?Math.ceil(u):Math.max((0|u)-this.X,0))*o,c=Math.min(4*f,e);if(f){for(var s=0;s<f;s+=o)this.B(r,s);t=r.splice(0,f),this.H.nSigBytes-=c}return new i.e(t,c)},n.prototype.B=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,r){r.d(t,{P:function(){return u}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.q=16,r.v=t,t&&"number"==typeof t.blockSize&&(r.q=t.blockSize),r.reset(t?t.data:void 0,t?t.nBytes:void 0),r}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.q},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.j()},t.prototype.update=function(n){return this.Y(n),this.R(),this},t.prototype.finalize=function(n){return n&&this.Y(n),this.F()},t.prototype.j=function(){throw new Error("Not implemented")},t.prototype.F=function(){throw new Error("Not implemented")},t}(e.C)},787:function(n,t,r){r.d(t,{G:function(){return s}});var i,e=r(9456),o=r(4344),u=r(7919),f=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),c=function(){return(c=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},s=function(n){function t(t){var r=n.call(this,t)||this;return r.q=4,r.Z=o.n,r.$=u.l,r.v=t,r.Z=void 0!==t.mode?t.mode:r.Z,r.$=void 0!==t.padding?t.padding:r.$,r.reset(null==t?void 0:t.data,null==t?void 0:t.nBytes),r}return f(t,n),Object.defineProperty(t.prototype,"mode",{get:function(){return this.nn},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"padding",{get:function(){return this.$},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){var i;n.prototype.reset.call(this,t,r),this.tn===e.t.ENC_TRANSFORM_MODE?i=this.Z.createEncryptor:(i=this.Z.createDecryptor,this.X=1),this.Z&&this.rn===i?this.nn=new this.Z({cipher:this,iv:this.en}):(this.nn=i.call(this.Z,{cipher:this,iv:this.en}),this.rn=i)},t.prototype.B=function(n,t){var r;null===(r=this.nn)||void 0===r||r.processBlock(n,t)},t.prototype.F=function(){var n,t=this.$;return this.tn===e.t.ENC_TRANSFORM_MODE?(t.pad(this.H,this.blockSize),n=this.R(!0)):(n=this.R(!0),t.unpad(n)),n},t.prototype.encryptBlock=function(n,t){throw new Error("Not implemented")},t.prototype.decryptBlock=function(n,t){throw new Error("Not implemented")},t.createEncryptor=function(n,r){return new t(c(c({},r=void 0===r?{}:r),{key:n,transformMode:e.t.ENC_TRANSFORM_MODE}))},t.createDecryptor=function(n,r){return new t(c(c({},r=void 0===r?{}:r),{key:n,transformMode:e.t.DEC_TRANSFORM_MODE}))},t}(e.t)},9456:function(n,t,r){r.d(t,{t:function(){return f}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(){return(u=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},f=function(n){function t(t){var r=n.call(this,t)||this;return r.tn=1,r.v=t,r.A=t.key,r.en=void 0!==t.iv?t.iv:r.en,r.tn=void 0!==t.transformMode?t.transformMode:r.tn,r}return o(t,n),Object.defineProperty(t.prototype,"iv",{get:function(){return this.en},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.j()},t.prototype.process=function(n){return this.Y(n),this.R()},t.prototype.finalize=function(n){return n&&this.Y(n),this.F()},t.prototype.j=function(){throw new Error("Not implemented")},t.prototype.B=function(n,t){throw new Error("Not implemented")},t.prototype.F=function(){throw new Error("Not implemented")},t.createEncryptor=function(n,r){return new t(u(u({},r=void 0===r?{}:r),{key:n,transformMode:t.ENC_TRANSFORM_MODE}))},t.createDecryptor=function(n,r){return new t(u(u({},r=void 0===r?{}:r),{key:n,transformMode:t.DEC_TRANSFORM_MODE}))},t.ENC_TRANSFORM_MODE=1,t.DEC_TRANSFORM_MODE=2,t.keySize=4,t.ivSize=4,t}(e.C)},2505:function(n,t,r){r.d(t,{Q:function(){return e}});var i=r(1232),e=function(){function n(n){this.formatter=i.w,n&&(this.cipherText=n.cipherText,this.key=n.key,this.iv=n.iv,this.salt=n.salt,this.Algorithm=n.Algorithm,this.mode=n.mode,this.padding=n.padding,this.blockSize=n.blockSize,this.formatter=n.formatter||i.w)}return n.prototype.toString=function(n){return(n||this.formatter).stringify(this)},n}()},5693:function(n,t,r){r.d(t,{E:function(){return c}});var i=r(9109),e=r(2214),o=r(2505),u=r(1232),f=function(){return(f=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},c={encrypt:function(n,t,r,u){var c=u?f({},u):{},s=u&&u.KDF?u.KDF:e.s,a={};u&&u.kdfHasher&&(a.kdfHasher=u.kdfHasher),u&&u.kdfIterations&&(a.kdfIterations=u.kdfIterations),u&&u.kdfModule&&(a.kdfModule=u.kdfModule);var h=s.execute(r,n.keySize,n.ivSize,c.kdfSalt,a);c.iv=h.iv;var v=i.D.encrypt(n,t,h.key,c);return new o.Q(f(f({},v),{key:h.key,iv:h.iv,salt:h.salt}))},decrypt:function(n,t,r,o){var c=o?f({},o):{},s=c.KDF?c.KDF:e.s,a=c.formatter?c.formatter:u.w,h=(0,i.W)(t,a),v={};o&&o.kdfHasher&&(v.kdfHasher=o.kdfHasher),o&&o.kdfIterations&&(v.kdfIterations=o.kdfIterations),o&&o.kdfModule&&(v.kdfModule=o.kdfModule);var w=s.execute(r,n.keySize,n.ivSize,h.salt,v);return c.iv=w.iv,i.D.decrypt(n,h,w.key,c)}}},9109:function(n,t,r){r.d(t,{W:function(){return o},D:function(){return u}});var i=r(1232),e=r(2505);function o(n,t){return"string"==typeof n?t.parse(n):n}var u={encrypt:function(n,t,r,o){var u=n.createEncryptor(r,o),f=u.finalize(t);return new e.Q({cipherText:f,key:r,iv:u.iv,Algorithm:n,mode:u.mode,padding:u.padding,blockSize:u.blockSize,formatter:(null==o?void 0:o.formatter)||i.w})},decrypt:function(n,t,r,e){var u=n.createDecryptor(r,e),f=o(t,(null==e?void 0:e.formatter)||i.w);return u.finalize(f.cipherText||"")}}},1232:function(n,t,r){r.d(t,{w:function(){return u}});var i=r(2505),e=r(3354),o=r(1773),u={stringify:function(n){var t=n.cipherText,r=n.salt;return t?r?new e.e([1398893684,1701076831]).concat(r).concat(t).toString(o.D):t.toString(o.D):""},parse:function(n){var t,r=o.D.parse(n),u=r.words;return 1398893684===u[0]&&1701076831===u[1]&&(t=new e.e(u.slice(2,4)),u.splice(0,4),r.nSigBytes-=16),new i.Q({cipherText:r,salt:t})}}},2214:function(n,t,r){r.d(t,{s:function(){return f}});var i=r(3354),e=r(2505),o=r(7008),u=function(){return(u=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},f={execute:function(n,t,r,f,c){f||(f=i.e.random(8));var s=c&&c.kdfModule||o.E,a=c?{Hasher:c.kdfHasher,iterations:c.kdfIterations}:{},h=s.getKey(n,f,u(u({},a),{keySize:t+r})),v=new i.e(h.words.slice(t),4*r);return h.nSigBytes=4*t,new e.Q({key:h,iv:v,salt:f})}}},7008:function(n,t,r){r.d(t,{E:function(){return s}});var i,e=r(5561),o=r(6367),u=r(3354),f=r(9541),c=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),s=function(n){function t(t){var r=n.call(this,t)||this;return r.on=4,r.un=e.SHA256,r.fn=1e4,t&&(r.on=void 0!==t.keySize?t.keySize:r.on,r.un=void 0!==t.Hasher?t.Hasher:r.un,r.fn=void 0!==t.iterations?t.iterations:r.fn),r}return c(t,n),t.prototype.compute=function(n,t){for(var r=new o.Hmac(new this.un,n),i=new u.e,e=new u.e([1]),f=i.words,c=e.words,s=this.on,a=this.fn;f.length<s;){var h=r.update(t).finalize(e);r.reset();for(var v=h.words,w=v.length,l=h,d=1;d<a;d++){l=r.finalize(l),r.reset();for(var b=l.words,y=0;y<w;y++)v[y]^=b[y]}i.concat(h),c[0]++}return i.nSigBytes=4*s,i},t.getKey=function(n,r,i){return new t(i).compute(n,r)},t}(f._)},9541:function(n,t,r){r.d(t,{_:function(){return i}});var i=function(){function n(n){this.v=n}return n.prototype.compute=function(n,t){throw new Error("Not implemented")},n.getKey=function(n,t,r){throw new Error("Not implemented")},n}()},1863:function(n,t,r){r.d(t,{T:function(){return i}});var i=function(){function n(n){this.v=n,this.cn=n.cipher,this.en=n.iv}return n.prototype.processBlock=function(n,t){},n.createEncryptor=function(n){throw new Error("Not implemented yet")},n.createDecryptor=function(n){throw new Error("Not implemented yet")},n}()},4344:function(n,t,r){r.d(t,{n:function(){return u}});var i,e=r(1863),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.sn=[],r}return o(t,n),t.prototype.xorBlock=function(n,t,r){var i,e=this.en;e?(i=e.words,this.en=void 0):i=this.sn;for(var o=0;o<r;o++)n[t+o]^=i[o]},t.createEncryptor=function(n){return new t.Encryptor(n)},t.createDecryptor=function(n){return new t.Decryptor(n)},t.Encryptor=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return o(t,n),t.prototype.processBlock=function(n,t){var r=this.cn,i=r.blockSize;this.xorBlock(n,t,i),r.encryptBlock(n,t),this.sn=n.slice(t,t+i)},t}(t),t.Decryptor=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return o(t,n),t.prototype.processBlock=function(n,t){var r=this.cn,i=r.blockSize,e=n.slice(t,t+i);r.decryptBlock(n,t),this.xorBlock(n,t,i),this.sn=e},t}(t),t}(e.T)},4055:function(n,t,r){r.d(t,{z6:function(){return e},ur:function(){return o}});var i=r(3354);function e(n,t){return new i.e(n.words.slice(),t)}function o(n,t){for(var r=n.nSigBytes-t,e=[],o=0;o<t;o++){var u=o>>>2,f=r+o,c=f>>>2,s=n.words[c]>>>24-f%4*8&255;e[u]=0|e[u]|s<<24-o%4*8}var a=new i.e(e,t);return a.clamp(),a}},7919:function(n,t,r){r.d(t,{l:function(){return e}});var i=r(3354);var e={pad:function(n,t){for(var r=4*t,e=r-n.nSigBytes%r,o=e<<24|e<<16|e<<8|e,u=[],f=0;f<e;f+=4)u.push(o);var c=new i.e(u,e);n.concat(c)},unpad:function(n){var t=255&n.words[n.nSigBytes-1>>>2];n.nSigBytes-=t}}},1756:function(n,t,r){r.d(t,{w:function(){return u}});var i,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(i=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(i)?(i=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(i)&&i):i);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},1773:function(n,t,r){r.d(t,{D:function(){return f}});for(var i=r(3354),e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=[],u=0;u<e.length;u++)o[e.charCodeAt(u)]=u;var f={stringify:function(n){var t=n.words,r=n.nSigBytes;n.clamp();for(var i=[],o=0;o<r;o+=3)for(var u=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,f=0;f<4&&o+.75*f<r;f++)i.push(e.charAt(u>>>6*(3-f)&63));var c=e.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(n){var t=n.length,r=e.charAt(64);if(r){var u=n.indexOf(r);-1!==u&&(t=u)}for(var f=[],c=0,s=0;s<t;s++)if(s%4){var a=o[n.charCodeAt(s-1)]<<s%4*2|o[n.charCodeAt(s)]>>>6-s%4*2;f[c>>>2]|=a<<24-c%4*8,c++}return new i.e(f,c)}}},5720:function(n,t,r){r.d(t,{p:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],e=0;e<t;e+=2)r[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new i.e(r,t/2)}}},8702:function(n,t,r){r.d(t,{m:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(n){for(var t=n.length,r=[],e=0;e<t;e++)r[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new i.e(r,t)}}},4768:function(n,t,r){r.d(t,{d:function(){return e}});var i=r(8702),e={stringify:function(n){try{return decodeURIComponent(escape(i.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return i.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,r){r.d(t,{M:function(){return e}});var i=r(1756);var e=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,i.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()},3664:function(n,t,r){r.d(t,{K:function(){return c}});var i,e=r(1863),o=r(3354),u=r(4055),f=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),c=function(n){function t(t){var r=n.call(this,t)||this;r.an=1;var i=t.cipher,e=t.iv;if(4!==i.blockSize)throw new Error("In CCM, cipher block size must be 128bit");if(e&&(e.nSigBytes>13||e.nSigBytes<7))throw new Error("Byte size of iv must be between 7 and 13");return r.hn=e||new o.e([0,0],8),r.vn=15-r.hn.nSigBytes,r}return f(t,n),t.getB0=function(n,t,r,i){if(r.nSigBytes+i.nSigBytes!==15)throw new Error("LEN(Q)+LEN(N) must be 15");var e=255&(0|(n?1:0)<<6|(t-2)/2<<3|r.nSigBytes-1),u=i.clone().concat(r);return new o.e([e<<24],1).concat(u)},t.formatAssociatedDataAndPayload=function(n,t){var r,i=n.nSigBytes;if(0===i)r=new o.e([0],0);else if(i<Math.pow(2,16)-Math.pow(2,8))r=new o.e([i<<16],2);else{if(!(i<Math.pow(2,32)))throw new Error("LEN(A) larger than 2**32-1 is not supported");r=new o.e([4294836224],2).concat(new o.e([i],4))}for(var e=Math.floor(n.nSigBytes/4),u=0;u<e;u++)r.concat(new o.e([n.words[u]],4));n.nSigBytes%4&&(r.concat(new o.e([n.words[e]],n.nSigBytes%4)),r.concat(new o.e([0],4-n.nSigBytes%4))),r.nSigBytes%16&&r.concat(new o.e([0],16-r.nSigBytes%16));var f=Math.floor(t.nSigBytes/4);for(u=0;u<f;u++)r.concat(new o.e([t.words[u]],4));return t.nSigBytes%4&&(r.concat(new o.e([t.words[f]],t.nSigBytes%4)),r.concat(new o.e([0],4-t.nSigBytes%4))),r.nSigBytes%16&&r.concat(new o.e([0],16-r.nSigBytes%16)),r},t.genCtr=function(n,t,r){if(t.nSigBytes+n!==15)throw new Error("LEN(Q)+LEN(N) must be 15");for(var i=new o.e([(n-1&7)<<24],1),e=new o.e([],0),u=Math.floor(n/4),f=0;f<u-1;f++)e.concat(new o.e([0],4));return n%4?n>4?(e.concat(new o.e([0],n%4)),e.concat(new o.e([r],4))):e.concat(new o.e([r<<32-8*n],n)):e.concat(new o.e([r],4)),i.concat(t).concat(e)},t.mac=function(n,r,i,e,f,c){var s=new n({key:r,iv:i});if(4!==s.blockSize)throw new Error("In CCM, cipher block size must be 128bit");if(i&&(i.nSigBytes>13||i.nSigBytes<7))throw new Error("Byte size of iv must be between 7 and 13");var a=i||new o.e([0,0],8),h=(null==e?void 0:e.clone())||new o.e,v=h.nSigBytes,w=(null==f?void 0:f.clone())||new o.e,l=w.nSigBytes;if(l>>>0>4294967295)throw new Error("Byte length of Payload(plainText) larger than 2^32-1 (4,294,967,295byte) is not supported at this time.");var d=15-a.nSigBytes,b=(0,u.ur)(new o.e([0,l],8),d),y=c||16,p=t.getB0(Boolean(v),y,b,a),m=t.formatAssociatedDataAndPayload(h,w),j=p.words.slice();s.encryptBlock(j,0);for(var g=m.nSigBytes/16,O=m.words,E=j,_=0;_<g;_++){var A=[O[4*_]^E[0],O[4*_+1]^E[1],O[4*_+2]^E[2],O[4*_+3]^E[3]];s.encryptBlock(A,0),E=A}var M=new o.e(E,y),N=t.genCtr(d,a,0);s.encryptBlock(N.words,0);for(_=0;_<4;_++)M.words[_]^=N.words[_];return M.clamp(),M},t.combineCipherTextAndAuthTag=function(n,t){return n.clone().concat(t)},t.splitCipherTextAndAuthTag=function(n,t){var r=t||16;return{cipherText:(0,u.z6)(n,n.nSigBytes-r),authTag:(0,u.ur)(n,r)}},t.createEncryptor=function(n){return new t.Encryptor(n)},t.createDecryptor=function(n){return new t.Decryptor(n)},t.Encryptor=function(n){function r(){return null!==n&&n.apply(this,arguments)||this}return f(r,n),r.prototype.processBlock=function(n,r){var i=this.cn,e=i.blockSize,o=t.genCtr(this.vn,this.hn,this.an);i.encryptBlock(o.words,0);for(var u=0;u<e;u++)n[r+u]^=o.words[u];this.an++},r}(t),t.Decryptor=function(n){function r(){return null!==n&&n.apply(this,arguments)||this}return f(r,n),r.prototype.processBlock=function(n,r){var i=this.cn,e=i.blockSize,o=t.genCtr(this.vn,this.hn,this.an);i.encryptBlock(o.words,0);for(var u=0;u<e;u++)n[r+u]^=o.words[u];this.an++},r}(t),t}(e.T)}},t={};function r(i){var e=t[i];if(void 0!==e)return e.exports;var o=t[i]={exports:{}};return n[i](o,o.exports,r),o.exports}r.d=function(n,t){for(var i in t)r.o(t,i)&&!r.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"wn",{value:!0})};var i={};return function(){r.r(i),r.d(i,{CBCMAC:function(){return u}});var n=r(4768),t=r(3354),e=r(9691),o=r(3664);function u(r,i,u,f,c,s){var a=s&&s.Cipher?s.Cipher:e.AES,h="string"==typeof u?n.d.parse(u):u,v=f||new t.e([0,0]),w="string"==typeof i?n.d.parse(i):i,l="string"==typeof r?n.d.parse(r):r,d=c||16;return o.K.mac(a,h,v,w,l,d)}}(),i}()}));
\ No newline at end of file
... ...
  1 +export { CipherParams } from "./lib/algorithm/cipher/CipherParams";
... ...
  1 +!function(r,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var n=t();for(var e in r.JsCrypto=r.JsCrypto||{},n)r.JsCrypto[e]=n[e]}}(this,(function(){return function(){"use strict";var r={d:function(t,n){for(var e in n)r.o(n,e)&&!r.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})}};r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(r){if("object"==typeof window)return window}}(),r.o=function(r,t){return Object.prototype.hasOwnProperty.call(r,t)},r.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"t",{value:!0})};var t={};r.r(t),r.d(t,{CipherParams:function(){return y}});var n,e=function(r){for(var t=r.nSigBytes,n=r.words,e=[],i=0;i<t;i++){var o=n[i>>>2]>>>24-i%4*8&255;e.push((o>>>4).toString(16)),e.push((15&o).toString(16))}return e.join("")},i="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(n=parseInt((/msie (\d+)/.exec(i)||[])[1],10),isNaN(n)?(n=parseInt((/trident\/.*; rv:(\d+)/.exec(i)||[])[1],10),!isNaN(n)&&n):n);for(var a=function(){if("undefined"!=typeof window){var t=window.crypto||window.msCrypto;if(!t){if(function(r,t){return!1!==o&&(!t||("<"===r?o<t:"<="===r?o<=t:">"===r?o>t:">="===r?o>=t:o===t))}("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return t.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}(),f=function(){function r(t,n){if(Array.isArray(t)||!t)return this.i=Array.isArray(t)?t:[],void(this.u="number"==typeof n?n:4*this.i.length);if(t instanceof r)return this.i=t.words.slice(),void(this.u=t.nSigBytes);var e;try{t instanceof ArrayBuffer?e=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(r){throw new Error("Invalid argument")}if(!e)throw new Error("Invalid argument");for(var i=e.byteLength,o=[],a=0;a<i;a++)o[a>>>2]|=e[a]<<24-a%4*8;this.i=o,this.u=i}return Object.defineProperty(r.prototype,"nSigBytes",{get:function(){return this.u},set:function(r){this.u=r},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"words",{get:function(){return this.i},enumerable:!1,configurable:!0}),r.prototype.toString=function(r){return r?r.stringify(this):e(this)},r.prototype.toUint8Array=function(){for(var r=this.i,t=this.u,n=new Uint8Array(t),e=0;e<t;e++)n[e]=r[e>>>2]>>>24-e%4*8&255;return n},r.prototype.concat=function(r){var t=r.words.slice(),n=r.nSigBytes;if(this.clamp(),this.u%4)for(var e=0;e<n;e++){var i=t[e>>>2]>>>24-e%4*8&255;this.i[this.u+e>>>2]|=i<<24-(this.u+e)%4*8}else for(e=0;e<n;e+=4)this.i[this.u+e>>>2]=t[e>>>2];return this.u+=n,this},r.prototype.clamp=function(){var r=this.u;this.i[r>>>2]&=4294967295<<32-r%4*8,this.i.length=Math.ceil(r/4)},r.prototype.clone=function(){return new r(this.i.slice(),this.u)},r.random=function(t){for(var n=[],e=0;e<t;e+=4)n.push(a());return new r(n,t)},r}(),u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s=[],c=0;c<u.length;c++)s[u.charCodeAt(c)]=c;var h={stringify:function(r){var t=r.words,n=r.nSigBytes;r.clamp();for(var e=[],i=0;i<n;i+=3)for(var o=(t[i>>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,a=0;a<4&&i+.75*a<n;a++)e.push(u.charAt(o>>>6*(3-a)&63));var f=u.charAt(64);if(f)for(;e.length%4;)e.push(f);return e.join("")},parse:function(r){var t=r.length,n=u.charAt(64);if(n){var e=r.indexOf(n);-1!==e&&(t=e)}for(var i=[],o=0,a=0;a<t;a++)if(a%4){var c=s[r.charCodeAt(a-1)]<<a%4*2|s[r.charCodeAt(a)]>>>6-a%4*2;i[o>>>2]|=c<<24-o%4*8,o++}return new f(i,o)}},v={stringify:function(r){var t=r.cipherText,n=r.salt;return t?n?new f([1398893684,1701076831]).concat(n).concat(t).toString(h):t.toString(h):""},parse:function(r){var t,n=h.parse(r),e=n.words;return 1398893684===e[0]&&1701076831===e[1]&&(t=new f(e.slice(2,4)),e.splice(0,4),n.nSigBytes-=16),new y({cipherText:n,salt:t})}},y=function(){function r(r){this.formatter=v,r&&(this.cipherText=r.cipherText,this.key=r.key,this.iv=r.iv,this.salt=r.salt,this.Algorithm=r.Algorithm,this.mode=r.mode,this.padding=r.padding,this.blockSize=r.blockSize,this.formatter=r.formatter||v)}return r.prototype.toString=function(r){return(r||this.formatter).stringify(this)},r}();return t}()}));
\ No newline at end of file
... ...
  1 +import { BlockCipher, BlockCipherProps } from "./lib/algorithm/cipher/BlockCipher";
  2 +import { CipherProps, PropsWithKey } from "./lib/algorithm/cipher/Cipher";
  3 +import { Word32Array } from "./lib/Word32Array";
  4 +import { CipherParams } from "./lib/algorithm/cipher/CipherParams";
  5 +export interface DESProps extends BlockCipherProps {
  6 +}
  7 +export declare class DES extends BlockCipher {
  8 + static readonly keySize: number;
  9 + static readonly ivSize: number;
  10 + protected _blockSize: number;
  11 + _props: PropsWithKey<DESProps>;
  12 + protected _subKeys: number[][];
  13 + protected _invSubKeys: number[][];
  14 + protected _lBlock: number;
  15 + protected _rBlock: number;
  16 + constructor(props: PropsWithKey<DESProps>);
  17 + protected _doReset(): void;
  18 + encryptBlock(words: number[], offset: number): void;
  19 + decryptBlock(words: number[], offset: number): void;
  20 + protected _doCryptoBlock(words: number[], offset: number, subKeys: number[][]): void;
  21 + protected _exchangeLR(offset: number, mask: number): void;
  22 + protected _exchangeRL(offset: number, mask: number): void;
  23 + /**
  24 + * Creates this cipher in encryption mode.
  25 + *
  26 + * @param {Word32Array} key The key.
  27 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  28 + * @return {Cipher} A cipher instance.
  29 + * @example
  30 + * var cipher = DES.createEncryptor(keyWordArray, { iv: ivWordArray });
  31 + */
  32 + static createEncryptor(key: Word32Array, props?: Partial<CipherProps>): DES;
  33 + /**
  34 + * Creates this cipher in decryption mode.
  35 + *
  36 + * @param {Word32Array} key The key.
  37 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  38 + * @return {Cipher} A cipher instance.
  39 + * @example
  40 + * var cipher = DES.createDecryptor(keyWordArray, { iv: ivWordArray });
  41 + */
  42 + static createDecryptor(key: Word32Array, props?: Partial<CipherProps>): DES;
  43 + /**
  44 + * Encrypt a message with key
  45 + *
  46 + * @param {Word32Array|string} message
  47 + * @param {Word32Array|string} key
  48 + * @param {Partial<AESProps>?} props
  49 + * @example
  50 + * var encryptedMessage = DES.encrypt("test", "pass");
  51 + */
  52 + static encrypt(message: Word32Array | string, key: Word32Array | string, props?: Partial<DESProps>): CipherParams;
  53 + /**
  54 + * Encrypt a encrypted message with key
  55 + *
  56 + * @param {CipherParams} cipherText
  57 + * @param {Word32Array|string} key
  58 + * @param {Partial<AESProps>?} props
  59 + * @example
  60 + * var encryptedMessage = DES.decrypt(cipherProps, "pass");
  61 + */
  62 + static decrypt(cipherText: CipherParams, key: Word32Array | string, props?: Partial<DESProps>): Word32Array;
  63 +}
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var i in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[i]=r[i]}}(this,(function(){return function(){"use strict";var n={6367:function(n,t,r){r.d(t,{Hmac:function(){return e}});var i=r(4768),e=function(){function n(n,t){this.i=n,"string"==typeof t&&(t=i.d.parse(t));var r=n.blockSize,e=4*r;t.nSigBytes>e&&(t=n.finalize(t)),t.clamp();for(var o=this.u=t.clone(),u=this.h=t.clone(),f=o.words,c=u.words,s=0;s<r;s++)f[s]^=1549556828,c[s]^=909522486;u.nSigBytes=e,o.nSigBytes=e,this.reset()}return n.prototype.reset=function(){this.i.reset(),this.i.update(this.h)},n.prototype.update=function(n){return this.i.update(n),this},n.prototype.finalize=function(n){var t=this.i.finalize(n);return this.i.reset(),this.i.finalize(this.u.clone().concat(t))},n}()},5561:function(n,t,r){r.d(t,{SHA256:function(){return v}});var i,e=r(1868),o=r(3354),u=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),f=[],c=[];function s(n){for(var t=Math.sqrt(n),r=2;r<=t;r++)if(!(n%r))return!1;return!0}function a(n){return 4294967296*(n-(0|n))|0}!function(){for(var n=2,t=0;t<64;)s(n)&&(t<8&&(f[t]=a(Math.pow(n,.5))),c[t]=a(Math.pow(n,1/3)),t++),n++}();var h=[],v=function(n){function t(t){var r=n.call(this,t)||this;return r.v=new o.e(f.slice(0)),r.j=t,t&&void 0!==t.hash&&(r.v=t.hash.clone()),r}return u(t,n),t.prototype.O=function(){this.v=new o.e(f.slice(0))},t.prototype.A=function(n,t){for(var r=this.v.words,i=r[0],e=r[1],o=r[2],u=r[3],f=r[4],s=r[5],a=r[6],v=r[7],w=0;w<64;w++){if(w<16)h[w]=0|n[t+w];else{var d=h[w-15],l=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,b=h[w-2],y=(b<<15|b>>>17)^(b<<13|b>>>19)^b>>>10;h[w]=l+h[w-7]+y+h[w-16]}var p=i&e^i&o^e&o,m=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),j=v+((f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25))+(f&s^~f&a)+c[w]+h[w];v=a,a=s,s=f,f=u+j|0,u=o,o=e,e=i,i=j+(m+p)|0}r[0]=r[0]+i|0,r[1]=r[1]+e|0,r[2]=r[2]+o|0,r[3]=r[3]+u|0,r[4]=r[4]+f|0,r[5]=r[5]+s|0,r[6]=r[6]+a|0,r[7]=r[7]+v|0},t.prototype.N=function(){var n=this.k.words,t=8*this.I,r=8*this.k.nSigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=Math.floor(t/4294967296),n[15+(r+64>>>9<<4)]=t,this.k.nSigBytes=4*n.length,this.S(),this.v},t.prototype.clone=function(){return new t({hash:this.v,blockSize:this.U,data:this.k,nBytes:this.I})},t.hash=function(n,r){return new t(r).finalize(n)},t}(e.P)},3354:function(n,t,r){r.d(t,{e:function(){return o}});var i=r(5720),e=r(9054),o=function(){function n(t,r){if(Array.isArray(t)||!t)return this.F=Array.isArray(t)?t:[],void(this.H="number"==typeof r?r:4*this.F.length);if(t instanceof n)return this.F=t.words.slice(),void(this.H=t.nSigBytes);var i;try{t instanceof ArrayBuffer?i=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!i)throw new Error("Invalid argument");for(var e=i.byteLength,o=[],u=0;u<e;u++)o[u>>>2]|=i[u]<<24-u%4*8;this.F=o,this.H=e}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.H},set:function(n){this.H=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.F},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):i.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.F,t=this.H,r=new Uint8Array(t),i=0;i<t;i++)r[i]=n[i>>>2]>>>24-i%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.H%4)for(var i=0;i<r;i++){var e=t[i>>>2]>>>24-i%4*8&255;this.F[this.H+i>>>2]|=e<<24-(this.H+i)%4*8}else for(i=0;i<r;i+=4)this.F[this.H+i>>>2]=t[i>>>2];return this.H+=r,this},n.prototype.clamp=function(){var n=this.H;this.F[n>>>2]&=4294967295<<32-n%4*8,this.F.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.F.slice(),this.H)},n.random=function(t){for(var r=[],i=0;i<t;i+=4)r.push((0,e.M)());return new n(r,t)},n}()},7211:function(n,t,r){r.d(t,{C:function(){return o}});var i=r(3354),e=r(4768),o=function(){function n(n){this.B=0,this.U=0,this.j=n,this.k=n&&void 0!==n.data?n.data.clone():new i.e,this.I=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.U},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.k=void 0!==n?n.clone():new i.e,this.I="number"==typeof t?t:0},n.prototype.R=function(n){var t="string"==typeof n?e.d.parse(n):n;this.k.concat(t),this.I+=t.nSigBytes},n.prototype.S=function(n){var t,r=this.k.words,e=this.k.nSigBytes,o=this.U,u=e/(4*this.U),f=(u=n?Math.ceil(u):Math.max((0|u)-this.B,0))*o,c=Math.min(4*f,e);if(f){for(var s=0;s<f;s+=o)this.A(r,s);t=r.splice(0,f),this.k.nSigBytes-=c}return new i.e(t,c)},n.prototype.A=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,r){r.d(t,{P:function(){return u}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.U=16,r.j=t,t&&"number"==typeof t.blockSize&&(r.U=t.blockSize),r.reset(t?t.data:void 0,t?t.nBytes:void 0),r}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.U},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.O()},t.prototype.update=function(n){return this.R(n),this.S(),this},t.prototype.finalize=function(n){return n&&this.R(n),this.N()},t.prototype.O=function(){throw new Error("Not implemented")},t.prototype.N=function(){throw new Error("Not implemented")},t}(e.C)},787:function(n,t,r){r.d(t,{G:function(){return s}});var i,e=r(9456),o=r(4344),u=r(7919),f=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),c=function(){return(c=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},s=function(n){function t(t){var r=n.call(this,t)||this;return r.U=4,r.q=o.n,r.J=u.l,r.j=t,r.q=void 0!==t.mode?t.mode:r.q,r.J=void 0!==t.padding?t.padding:r.J,r.reset(null==t?void 0:t.data,null==t?void 0:t.nBytes),r}return f(t,n),Object.defineProperty(t.prototype,"mode",{get:function(){return this.K},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"padding",{get:function(){return this.J},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){var i;n.prototype.reset.call(this,t,r),this.L===e.t.ENC_TRANSFORM_MODE?i=this.q.createEncryptor:(i=this.q.createDecryptor,this.B=1),this.q&&this.V===i?this.K=new this.q({cipher:this,iv:this.X}):(this.K=i.call(this.q,{cipher:this,iv:this.X}),this.V=i)},t.prototype.A=function(n,t){var r;null===(r=this.K)||void 0===r||r.processBlock(n,t)},t.prototype.N=function(){var n,t=this.J;return this.L===e.t.ENC_TRANSFORM_MODE?(t.pad(this.k,this.blockSize),n=this.S(!0)):(n=this.S(!0),t.unpad(n)),n},t.prototype.encryptBlock=function(n,t){throw new Error("Not implemented")},t.prototype.decryptBlock=function(n,t){throw new Error("Not implemented")},t.createEncryptor=function(n,r){return new t(c(c({},r=void 0===r?{}:r),{key:n,transformMode:e.t.ENC_TRANSFORM_MODE}))},t.createDecryptor=function(n,r){return new t(c(c({},r=void 0===r?{}:r),{key:n,transformMode:e.t.DEC_TRANSFORM_MODE}))},t}(e.t)},9456:function(n,t,r){r.d(t,{t:function(){return f}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(){return(u=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},f=function(n){function t(t){var r=n.call(this,t)||this;return r.L=1,r.j=t,r.Y=t.key,r.X=void 0!==t.iv?t.iv:r.X,r.L=void 0!==t.transformMode?t.transformMode:r.L,r}return o(t,n),Object.defineProperty(t.prototype,"iv",{get:function(){return this.X},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.O()},t.prototype.process=function(n){return this.R(n),this.S()},t.prototype.finalize=function(n){return n&&this.R(n),this.N()},t.prototype.O=function(){throw new Error("Not implemented")},t.prototype.A=function(n,t){throw new Error("Not implemented")},t.prototype.N=function(){throw new Error("Not implemented")},t.createEncryptor=function(n,r){return new t(u(u({},r=void 0===r?{}:r),{key:n,transformMode:t.ENC_TRANSFORM_MODE}))},t.createDecryptor=function(n,r){return new t(u(u({},r=void 0===r?{}:r),{key:n,transformMode:t.DEC_TRANSFORM_MODE}))},t.ENC_TRANSFORM_MODE=1,t.DEC_TRANSFORM_MODE=2,t.keySize=4,t.ivSize=4,t}(e.C)},2505:function(n,t,r){r.d(t,{Q:function(){return e}});var i=r(1232),e=function(){function n(n){this.formatter=i.w,n&&(this.cipherText=n.cipherText,this.key=n.key,this.iv=n.iv,this.salt=n.salt,this.Algorithm=n.Algorithm,this.mode=n.mode,this.padding=n.padding,this.blockSize=n.blockSize,this.formatter=n.formatter||i.w)}return n.prototype.toString=function(n){return(n||this.formatter).stringify(this)},n}()},5693:function(n,t,r){r.d(t,{E:function(){return c}});var i=r(9109),e=r(2214),o=r(2505),u=r(1232),f=function(){return(f=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},c={encrypt:function(n,t,r,u){var c=u?f({},u):{},s=u&&u.KDF?u.KDF:e.s,a={};u&&u.kdfHasher&&(a.kdfHasher=u.kdfHasher),u&&u.kdfIterations&&(a.kdfIterations=u.kdfIterations),u&&u.kdfModule&&(a.kdfModule=u.kdfModule);var h=s.execute(r,n.keySize,n.ivSize,c.kdfSalt,a);c.iv=h.iv;var v=i.D.encrypt(n,t,h.key,c);return new o.Q(f(f({},v),{key:h.key,iv:h.iv,salt:h.salt}))},decrypt:function(n,t,r,o){var c=o?f({},o):{},s=c.KDF?c.KDF:e.s,a=c.formatter?c.formatter:u.w,h=(0,i.W)(t,a),v={};o&&o.kdfHasher&&(v.kdfHasher=o.kdfHasher),o&&o.kdfIterations&&(v.kdfIterations=o.kdfIterations),o&&o.kdfModule&&(v.kdfModule=o.kdfModule);var w=s.execute(r,n.keySize,n.ivSize,h.salt,v);return c.iv=w.iv,i.D.decrypt(n,h,w.key,c)}}},9109:function(n,t,r){r.d(t,{W:function(){return o},D:function(){return u}});var i=r(1232),e=r(2505);function o(n,t){return"string"==typeof n?t.parse(n):n}var u={encrypt:function(n,t,r,o){var u=n.createEncryptor(r,o),f=u.finalize(t);return new e.Q({cipherText:f,key:r,iv:u.iv,Algorithm:n,mode:u.mode,padding:u.padding,blockSize:u.blockSize,formatter:(null==o?void 0:o.formatter)||i.w})},decrypt:function(n,t,r,e){var u=n.createDecryptor(r,e),f=o(t,(null==e?void 0:e.formatter)||i.w);return u.finalize(f.cipherText||"")}}},1232:function(n,t,r){r.d(t,{w:function(){return u}});var i=r(2505),e=r(3354),o=r(1773),u={stringify:function(n){var t=n.cipherText,r=n.salt;return t?r?new e.e([1398893684,1701076831]).concat(r).concat(t).toString(o.D):t.toString(o.D):""},parse:function(n){var t,r=o.D.parse(n),u=r.words;return 1398893684===u[0]&&1701076831===u[1]&&(t=new e.e(u.slice(2,4)),u.splice(0,4),r.nSigBytes-=16),new i.Q({cipherText:r,salt:t})}}},2214:function(n,t,r){r.d(t,{s:function(){return f}});var i=r(3354),e=r(2505),o=r(7008),u=function(){return(u=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},f={execute:function(n,t,r,f,c){f||(f=i.e.random(8));var s=c&&c.kdfModule||o.E,a=c?{Hasher:c.kdfHasher,iterations:c.kdfIterations}:{},h=s.getKey(n,f,u(u({},a),{keySize:t+r})),v=new i.e(h.words.slice(t),4*r);return h.nSigBytes=4*t,new e.Q({key:h,iv:v,salt:f})}}},7008:function(n,t,r){r.d(t,{E:function(){return s}});var i,e=r(5561),o=r(6367),u=r(3354),f=r(9541),c=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),s=function(n){function t(t){var r=n.call(this,t)||this;return r.Z=4,r.$=e.SHA256,r.nn=1e4,t&&(r.Z=void 0!==t.keySize?t.keySize:r.Z,r.$=void 0!==t.Hasher?t.Hasher:r.$,r.nn=void 0!==t.iterations?t.iterations:r.nn),r}return c(t,n),t.prototype.compute=function(n,t){for(var r=new o.Hmac(new this.$,n),i=new u.e,e=new u.e([1]),f=i.words,c=e.words,s=this.Z,a=this.nn;f.length<s;){var h=r.update(t).finalize(e);r.reset();for(var v=h.words,w=v.length,d=h,l=1;l<a;l++){d=r.finalize(d),r.reset();for(var b=d.words,y=0;y<w;y++)v[y]^=b[y]}i.concat(h),c[0]++}return i.nSigBytes=4*s,i},t.getKey=function(n,r,i){return new t(i).compute(n,r)},t}(f._)},9541:function(n,t,r){r.d(t,{_:function(){return i}});var i=function(){function n(n){this.j=n}return n.prototype.compute=function(n,t){throw new Error("Not implemented")},n.getKey=function(n,t,r){throw new Error("Not implemented")},n}()},1863:function(n,t,r){r.d(t,{T:function(){return i}});var i=function(){function n(n){this.j=n,this.tn=n.cipher,this.X=n.iv}return n.prototype.processBlock=function(n,t){},n.createEncryptor=function(n){throw new Error("Not implemented yet")},n.createDecryptor=function(n){throw new Error("Not implemented yet")},n}()},4344:function(n,t,r){r.d(t,{n:function(){return u}});var i,e=r(1863),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.rn=[],r}return o(t,n),t.prototype.xorBlock=function(n,t,r){var i,e=this.X;e?(i=e.words,this.X=void 0):i=this.rn;for(var o=0;o<r;o++)n[t+o]^=i[o]},t.createEncryptor=function(n){return new t.Encryptor(n)},t.createDecryptor=function(n){return new t.Decryptor(n)},t.Encryptor=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return o(t,n),t.prototype.processBlock=function(n,t){var r=this.tn,i=r.blockSize;this.xorBlock(n,t,i),r.encryptBlock(n,t),this.rn=n.slice(t,t+i)},t}(t),t.Decryptor=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return o(t,n),t.prototype.processBlock=function(n,t){var r=this.tn,i=r.blockSize,e=n.slice(t,t+i);r.decryptBlock(n,t),this.xorBlock(n,t,i),this.rn=e},t}(t),t}(e.T)},7919:function(n,t,r){r.d(t,{l:function(){return e}});var i=r(3354);var e={pad:function(n,t){for(var r=4*t,e=r-n.nSigBytes%r,o=e<<24|e<<16|e<<8|e,u=[],f=0;f<e;f+=4)u.push(o);var c=new i.e(u,e);n.concat(c)},unpad:function(n){var t=255&n.words[n.nSigBytes-1>>>2];n.nSigBytes-=t}}},1756:function(n,t,r){r.d(t,{w:function(){return u}});var i,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(i=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(i)?(i=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(i)&&i):i);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},1773:function(n,t,r){r.d(t,{D:function(){return f}});for(var i=r(3354),e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=[],u=0;u<e.length;u++)o[e.charCodeAt(u)]=u;var f={stringify:function(n){var t=n.words,r=n.nSigBytes;n.clamp();for(var i=[],o=0;o<r;o+=3)for(var u=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,f=0;f<4&&o+.75*f<r;f++)i.push(e.charAt(u>>>6*(3-f)&63));var c=e.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(n){var t=n.length,r=e.charAt(64);if(r){var u=n.indexOf(r);-1!==u&&(t=u)}for(var f=[],c=0,s=0;s<t;s++)if(s%4){var a=o[n.charCodeAt(s-1)]<<s%4*2|o[n.charCodeAt(s)]>>>6-s%4*2;f[c>>>2]|=a<<24-c%4*8,c++}return new i.e(f,c)}}},5720:function(n,t,r){r.d(t,{p:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],e=0;e<t;e+=2)r[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new i.e(r,t/2)}}},8702:function(n,t,r){r.d(t,{m:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(n){for(var t=n.length,r=[],e=0;e<t;e++)r[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new i.e(r,t)}}},4768:function(n,t,r){r.d(t,{d:function(){return e}});var i=r(8702),e={stringify:function(n){try{return decodeURIComponent(escape(i.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return i.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,r){r.d(t,{M:function(){return e}});var i=r(1756);var e=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,i.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function r(i){var e=t[i];if(void 0!==e)return e.exports;var o=t[i]={exports:{}};return n[i](o,o.exports,r),o.exports}r.d=function(n,t){for(var i in t)r.o(t,i)&&!r.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"en",{value:!0})};var i={};return function(){r.r(i),r.d(i,{DES:function(){return d}});var n,t=r(787),e=r(9456),o=r(5693),u=r(9109),f=(n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(t,r)},function(t,r){function i(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}),c=function(){return(c=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],h=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],v=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],w=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=function(n){function t(t){var r=n.call(this,t)||this;return r.U=2,r.on=[],r.un=[],r.fn=0,r.cn=0,r.j=t,r.O(),r}return f(t,n),t.prototype.O=function(){for(var n=this.Y.words,t=[],r=0;r<56;r++){var i=s[r]-1;t[r]=n[i>>>5]>>>31-i%32&1}for(var e=this.on=[],o=0;o<16;o++){var u=e[o]=[],f=h[o];for(r=0;r<24;r++)u[r/6|0]|=t[(a[r]-1+f)%28]<<31-r%6,u[4+(r/6|0)]|=t[28+(a[r+24]-1+f)%28]<<31-r%6;u[0]=u[0]<<1|u[0]>>>31;for(r=1;r<7;r++)u[r]=u[r]>>>4*(r-1)+3;u[7]=u[7]<<5|u[7]>>>27}this.un=[];for(r=0;r<16;r++)this.un[r]=e[15-r]},t.prototype.encryptBlock=function(n,t){this.sn(n,t,this.on)},t.prototype.decryptBlock=function(n,t){this.sn(n,t,this.un)},t.prototype.sn=function(n,t,r){this.fn=n[t],this.cn=n[t+1],this.an(4,252645135),this.an(16,65535),this.hn(2,858993459),this.hn(8,16711935),this.an(1,1431655765);for(var i=0;i<16;i++){for(var e=r[i],o=this.fn,u=this.cn,f=0,c=0;c<8;c++){var s=(u^e[c])&w[c];f|=v[c][s>>>0]}this.fn=u,this.cn=o^f}var a=this.fn;this.fn=this.cn,this.cn=a,this.an(1,1431655765),this.hn(8,16711935),this.hn(2,858993459),this.an(16,65535),this.an(4,252645135),n[t]=this.fn,n[t+1]=this.cn},t.prototype.an=function(n,t){var r=(this.fn>>>n^this.cn)&t;this.cn^=r,this.fn^=r<<n},t.prototype.hn=function(n,t){var r=(this.cn>>>n^this.fn)&t;this.fn^=r,this.cn^=r<<n},t.createEncryptor=function(n,r){return new t(c(c({},r=void 0===r?{}:r),{key:n,transformMode:e.t.ENC_TRANSFORM_MODE}))},t.createDecryptor=function(n,r){return new t(c(c({},r=void 0===r?{}:r),{key:n,transformMode:e.t.DEC_TRANSFORM_MODE}))},t.encrypt=function(n,r,i){return"string"==typeof r?o.E.encrypt(t,n,r,i):u.D.encrypt(t,n,r,i)},t.decrypt=function(n,r,i){return"string"==typeof r?o.E.decrypt(t,n,r,i):u.D.decrypt(t,n,r,i)},t.keySize=2,t.ivSize=2,t}(t.G)}(),i}()}));
\ No newline at end of file
... ...
  1 +import { BlockCipher, BlockCipherProps } from "./lib/algorithm/cipher/BlockCipher";
  2 +import { CipherProps, PropsWithKey } from "./lib/algorithm/cipher/Cipher";
  3 +import { DES } from "./DES";
  4 +import { Word32Array } from "./lib/Word32Array";
  5 +import { CipherParams } from "./lib/algorithm/cipher/CipherParams";
  6 +export interface DES3Props extends BlockCipherProps {
  7 +}
  8 +export declare class DES3 extends BlockCipher {
  9 + static readonly keySize: number;
  10 + static readonly ivSize: number;
  11 + protected _blockSize: number;
  12 + protected _des1: DES;
  13 + protected _des2: DES;
  14 + protected _des3: DES;
  15 + constructor(props: PropsWithKey<DES3Props>);
  16 + protected _get3DES(): DES[];
  17 + protected _doReset(): void;
  18 + encryptBlock(words: number[], offset: number): void;
  19 + decryptBlock(words: number[], offset: number): void;
  20 + /**
  21 + * Creates this cipher in encryption mode.
  22 + *
  23 + * @param {Word32Array} key The key.
  24 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  25 + * @return {Cipher} A cipher instance.
  26 + * @example
  27 + * var cipher = DES3.createEncryptor(keyWordArray, { iv: ivWordArray });
  28 + */
  29 + static createEncryptor(key: Word32Array, props?: Partial<CipherProps>): DES3;
  30 + /**
  31 + * Creates this cipher in decryption mode.
  32 + *
  33 + * @param {Word32Array} key The key.
  34 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  35 + * @return {Cipher} A cipher instance.
  36 + * @example
  37 + * var cipher = DES3.createDecryptor(keyWordArray, { iv: ivWordArray });
  38 + */
  39 + static createDecryptor(key: Word32Array, props?: Partial<CipherProps>): DES3;
  40 + /**
  41 + * Encrypt a message with key
  42 + *
  43 + * @param {Word32Array|string} message
  44 + * @param {Word32Array|string} key
  45 + * @param {Partial<AESProps>?} props
  46 + * @example
  47 + * var encryptedMessage = DES3.encrypt("test", "pass");
  48 + */
  49 + static encrypt(message: Word32Array | string, key: Word32Array | string, props?: Partial<DES3Props>): CipherParams;
  50 + /**
  51 + * Encrypt a encrypted message with key
  52 + *
  53 + * @param {CipherParams} cipherText
  54 + * @param {Word32Array|string} key
  55 + * @param {Partial<AESProps>?} props
  56 + * @example
  57 + * var encryptedMessage = DES3.decrypt(cipherProps, "pass");
  58 + */
  59 + static decrypt(cipherText: CipherParams, key: Word32Array | string, props?: Partial<DES3Props>): Word32Array;
  60 +}
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var i in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[i]=r[i]}}(this,(function(){return function(){"use strict";var n={9910:function(n,t,r){r.d(t,{DES:function(){return l}});var i,e=r(787),o=r(9456),u=r(5693),f=r(9109),c=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),s=function(){return(s=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],h=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],v=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],w=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],d=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],l=function(n){function t(t){var r=n.call(this,t)||this;return r.i=2,r.u=[],r.h=[],r.v=0,r.j=0,r.O=t,r.A(),r}return c(t,n),t.prototype.A=function(){for(var n=this.k.words,t=[],r=0;r<56;r++){var i=a[r]-1;t[r]=n[i>>>5]>>>31-i%32&1}for(var e=this.u=[],o=0;o<16;o++){var u=e[o]=[],f=v[o];for(r=0;r<24;r++)u[r/6|0]|=t[(h[r]-1+f)%28]<<31-r%6,u[4+(r/6|0)]|=t[28+(h[r+24]-1+f)%28]<<31-r%6;u[0]=u[0]<<1|u[0]>>>31;for(r=1;r<7;r++)u[r]=u[r]>>>4*(r-1)+3;u[7]=u[7]<<5|u[7]>>>27}this.h=[];for(r=0;r<16;r++)this.h[r]=e[15-r]},t.prototype.encryptBlock=function(n,t){this.N(n,t,this.u)},t.prototype.decryptBlock=function(n,t){this.N(n,t,this.h)},t.prototype.N=function(n,t,r){this.v=n[t],this.j=n[t+1],this.I(4,252645135),this.I(16,65535),this.S(2,858993459),this.S(8,16711935),this.I(1,1431655765);for(var i=0;i<16;i++){for(var e=r[i],o=this.v,u=this.j,f=0,c=0;c<8;c++){var s=(u^e[c])&d[c];f|=w[c][s>>>0]}this.v=u,this.j=o^f}var a=this.v;this.v=this.j,this.j=a,this.I(1,1431655765),this.S(8,16711935),this.S(2,858993459),this.I(16,65535),this.I(4,252645135),n[t]=this.v,n[t+1]=this.j},t.prototype.I=function(n,t){var r=(this.v>>>n^this.j)&t;this.j^=r,this.v^=r<<n},t.prototype.S=function(n,t){var r=(this.j>>>n^this.v)&t;this.v^=r,this.j^=r<<n},t.createEncryptor=function(n,r){return new t(s(s({},r=void 0===r?{}:r),{key:n,transformMode:o.t.ENC_TRANSFORM_MODE}))},t.createDecryptor=function(n,r){return new t(s(s({},r=void 0===r?{}:r),{key:n,transformMode:o.t.DEC_TRANSFORM_MODE}))},t.encrypt=function(n,r,i){return"string"==typeof r?u.E.encrypt(t,n,r,i):f.D.encrypt(t,n,r,i)},t.decrypt=function(n,r,i){return"string"==typeof r?u.E.decrypt(t,n,r,i):f.D.decrypt(t,n,r,i)},t.keySize=2,t.ivSize=2,t}(e.G)},6367:function(n,t,r){r.d(t,{Hmac:function(){return e}});var i=r(4768),e=function(){function n(n,t){this.U=n,"string"==typeof t&&(t=i.d.parse(t));var r=n.blockSize,e=4*r;t.nSigBytes>e&&(t=n.finalize(t)),t.clamp();for(var o=this.F=t.clone(),u=this.H=t.clone(),f=o.words,c=u.words,s=0;s<r;s++)f[s]^=1549556828,c[s]^=909522486;u.nSigBytes=e,o.nSigBytes=e,this.reset()}return n.prototype.reset=function(){this.U.reset(),this.U.update(this.H)},n.prototype.update=function(n){return this.U.update(n),this},n.prototype.finalize=function(n){var t=this.U.finalize(n);return this.U.reset(),this.U.finalize(this.F.clone().concat(t))},n}()},5561:function(n,t,r){r.d(t,{SHA256:function(){return v}});var i,e=r(1868),o=r(3354),u=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),f=[],c=[];function s(n){for(var t=Math.sqrt(n),r=2;r<=t;r++)if(!(n%r))return!1;return!0}function a(n){return 4294967296*(n-(0|n))|0}!function(){for(var n=2,t=0;t<64;)s(n)&&(t<8&&(f[t]=a(Math.pow(n,.5))),c[t]=a(Math.pow(n,1/3)),t++),n++}();var h=[],v=function(n){function t(t){var r=n.call(this,t)||this;return r.B=new o.e(f.slice(0)),r.O=t,t&&void 0!==t.hash&&(r.B=t.hash.clone()),r}return u(t,n),t.prototype.A=function(){this.B=new o.e(f.slice(0))},t.prototype.q=function(n,t){for(var r=this.B.words,i=r[0],e=r[1],o=r[2],u=r[3],f=r[4],s=r[5],a=r[6],v=r[7],w=0;w<64;w++){if(w<16)h[w]=0|n[t+w];else{var d=h[w-15],l=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,b=h[w-2],y=(b<<15|b>>>17)^(b<<13|b>>>19)^b>>>10;h[w]=l+h[w-7]+y+h[w-16]}var p=i&e^i&o^e&o,m=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),j=v+((f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25))+(f&s^~f&a)+c[w]+h[w];v=a,a=s,s=f,f=u+j|0,u=o,o=e,e=i,i=j+(m+p)|0}r[0]=r[0]+i|0,r[1]=r[1]+e|0,r[2]=r[2]+o|0,r[3]=r[3]+u|0,r[4]=r[4]+f|0,r[5]=r[5]+s|0,r[6]=r[6]+a|0,r[7]=r[7]+v|0},t.prototype.R=function(){var n=this.J.words,t=8*this.K,r=8*this.J.nSigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=Math.floor(t/4294967296),n[15+(r+64>>>9<<4)]=t,this.J.nSigBytes=4*n.length,this.L(),this.B},t.prototype.clone=function(){return new t({hash:this.B,blockSize:this.i,data:this.J,nBytes:this.K})},t.hash=function(n,r){return new t(r).finalize(n)},t}(e.P)},3354:function(n,t,r){r.d(t,{e:function(){return o}});var i=r(5720),e=r(9054),o=function(){function n(t,r){if(Array.isArray(t)||!t)return this.V=Array.isArray(t)?t:[],void(this.X="number"==typeof r?r:4*this.V.length);if(t instanceof n)return this.V=t.words.slice(),void(this.X=t.nSigBytes);var i;try{t instanceof ArrayBuffer?i=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!i)throw new Error("Invalid argument");for(var e=i.byteLength,o=[],u=0;u<e;u++)o[u>>>2]|=i[u]<<24-u%4*8;this.V=o,this.X=e}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.X},set:function(n){this.X=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.V},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):i.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.V,t=this.X,r=new Uint8Array(t),i=0;i<t;i++)r[i]=n[i>>>2]>>>24-i%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.X%4)for(var i=0;i<r;i++){var e=t[i>>>2]>>>24-i%4*8&255;this.V[this.X+i>>>2]|=e<<24-(this.X+i)%4*8}else for(i=0;i<r;i+=4)this.V[this.X+i>>>2]=t[i>>>2];return this.X+=r,this},n.prototype.clamp=function(){var n=this.X;this.V[n>>>2]&=4294967295<<32-n%4*8,this.V.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.V.slice(),this.X)},n.random=function(t){for(var r=[],i=0;i<t;i+=4)r.push((0,e.M)());return new n(r,t)},n}()},7211:function(n,t,r){r.d(t,{C:function(){return o}});var i=r(3354),e=r(4768),o=function(){function n(n){this.Y=0,this.i=0,this.O=n,this.J=n&&void 0!==n.data?n.data.clone():new i.e,this.K=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.i},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.J=void 0!==n?n.clone():new i.e,this.K="number"==typeof t?t:0},n.prototype.Z=function(n){var t="string"==typeof n?e.d.parse(n):n;this.J.concat(t),this.K+=t.nSigBytes},n.prototype.L=function(n){var t,r=this.J.words,e=this.J.nSigBytes,o=this.i,u=e/(4*this.i),f=(u=n?Math.ceil(u):Math.max((0|u)-this.Y,0))*o,c=Math.min(4*f,e);if(f){for(var s=0;s<f;s+=o)this.q(r,s);t=r.splice(0,f),this.J.nSigBytes-=c}return new i.e(t,c)},n.prototype.q=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,r){r.d(t,{P:function(){return u}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.i=16,r.O=t,t&&"number"==typeof t.blockSize&&(r.i=t.blockSize),r.reset(t?t.data:void 0,t?t.nBytes:void 0),r}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.i},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.A()},t.prototype.update=function(n){return this.Z(n),this.L(),this},t.prototype.finalize=function(n){return n&&this.Z(n),this.R()},t.prototype.A=function(){throw new Error("Not implemented")},t.prototype.R=function(){throw new Error("Not implemented")},t}(e.C)},787:function(n,t,r){r.d(t,{G:function(){return s}});var i,e=r(9456),o=r(4344),u=r(7919),f=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),c=function(){return(c=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},s=function(n){function t(t){var r=n.call(this,t)||this;return r.i=4,r.$=o.n,r.nn=u.l,r.O=t,r.$=void 0!==t.mode?t.mode:r.$,r.nn=void 0!==t.padding?t.padding:r.nn,r.reset(null==t?void 0:t.data,null==t?void 0:t.nBytes),r}return f(t,n),Object.defineProperty(t.prototype,"mode",{get:function(){return this.tn},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"padding",{get:function(){return this.nn},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){var i;n.prototype.reset.call(this,t,r),this.rn===e.t.ENC_TRANSFORM_MODE?i=this.$.createEncryptor:(i=this.$.createDecryptor,this.Y=1),this.$&&this.en===i?this.tn=new this.$({cipher:this,iv:this.on}):(this.tn=i.call(this.$,{cipher:this,iv:this.on}),this.en=i)},t.prototype.q=function(n,t){var r;null===(r=this.tn)||void 0===r||r.processBlock(n,t)},t.prototype.R=function(){var n,t=this.nn;return this.rn===e.t.ENC_TRANSFORM_MODE?(t.pad(this.J,this.blockSize),n=this.L(!0)):(n=this.L(!0),t.unpad(n)),n},t.prototype.encryptBlock=function(n,t){throw new Error("Not implemented")},t.prototype.decryptBlock=function(n,t){throw new Error("Not implemented")},t.createEncryptor=function(n,r){return new t(c(c({},r=void 0===r?{}:r),{key:n,transformMode:e.t.ENC_TRANSFORM_MODE}))},t.createDecryptor=function(n,r){return new t(c(c({},r=void 0===r?{}:r),{key:n,transformMode:e.t.DEC_TRANSFORM_MODE}))},t}(e.t)},9456:function(n,t,r){r.d(t,{t:function(){return f}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(){return(u=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},f=function(n){function t(t){var r=n.call(this,t)||this;return r.rn=1,r.O=t,r.k=t.key,r.on=void 0!==t.iv?t.iv:r.on,r.rn=void 0!==t.transformMode?t.transformMode:r.rn,r}return o(t,n),Object.defineProperty(t.prototype,"iv",{get:function(){return this.on},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.A()},t.prototype.process=function(n){return this.Z(n),this.L()},t.prototype.finalize=function(n){return n&&this.Z(n),this.R()},t.prototype.A=function(){throw new Error("Not implemented")},t.prototype.q=function(n,t){throw new Error("Not implemented")},t.prototype.R=function(){throw new Error("Not implemented")},t.createEncryptor=function(n,r){return new t(u(u({},r=void 0===r?{}:r),{key:n,transformMode:t.ENC_TRANSFORM_MODE}))},t.createDecryptor=function(n,r){return new t(u(u({},r=void 0===r?{}:r),{key:n,transformMode:t.DEC_TRANSFORM_MODE}))},t.ENC_TRANSFORM_MODE=1,t.DEC_TRANSFORM_MODE=2,t.keySize=4,t.ivSize=4,t}(e.C)},2505:function(n,t,r){r.d(t,{Q:function(){return e}});var i=r(1232),e=function(){function n(n){this.formatter=i.w,n&&(this.cipherText=n.cipherText,this.key=n.key,this.iv=n.iv,this.salt=n.salt,this.Algorithm=n.Algorithm,this.mode=n.mode,this.padding=n.padding,this.blockSize=n.blockSize,this.formatter=n.formatter||i.w)}return n.prototype.toString=function(n){return(n||this.formatter).stringify(this)},n}()},5693:function(n,t,r){r.d(t,{E:function(){return c}});var i=r(9109),e=r(2214),o=r(2505),u=r(1232),f=function(){return(f=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},c={encrypt:function(n,t,r,u){var c=u?f({},u):{},s=u&&u.KDF?u.KDF:e.s,a={};u&&u.kdfHasher&&(a.kdfHasher=u.kdfHasher),u&&u.kdfIterations&&(a.kdfIterations=u.kdfIterations),u&&u.kdfModule&&(a.kdfModule=u.kdfModule);var h=s.execute(r,n.keySize,n.ivSize,c.kdfSalt,a);c.iv=h.iv;var v=i.D.encrypt(n,t,h.key,c);return new o.Q(f(f({},v),{key:h.key,iv:h.iv,salt:h.salt}))},decrypt:function(n,t,r,o){var c=o?f({},o):{},s=c.KDF?c.KDF:e.s,a=c.formatter?c.formatter:u.w,h=(0,i.W)(t,a),v={};o&&o.kdfHasher&&(v.kdfHasher=o.kdfHasher),o&&o.kdfIterations&&(v.kdfIterations=o.kdfIterations),o&&o.kdfModule&&(v.kdfModule=o.kdfModule);var w=s.execute(r,n.keySize,n.ivSize,h.salt,v);return c.iv=w.iv,i.D.decrypt(n,h,w.key,c)}}},9109:function(n,t,r){r.d(t,{W:function(){return o},D:function(){return u}});var i=r(1232),e=r(2505);function o(n,t){return"string"==typeof n?t.parse(n):n}var u={encrypt:function(n,t,r,o){var u=n.createEncryptor(r,o),f=u.finalize(t);return new e.Q({cipherText:f,key:r,iv:u.iv,Algorithm:n,mode:u.mode,padding:u.padding,blockSize:u.blockSize,formatter:(null==o?void 0:o.formatter)||i.w})},decrypt:function(n,t,r,e){var u=n.createDecryptor(r,e),f=o(t,(null==e?void 0:e.formatter)||i.w);return u.finalize(f.cipherText||"")}}},1232:function(n,t,r){r.d(t,{w:function(){return u}});var i=r(2505),e=r(3354),o=r(1773),u={stringify:function(n){var t=n.cipherText,r=n.salt;return t?r?new e.e([1398893684,1701076831]).concat(r).concat(t).toString(o.D):t.toString(o.D):""},parse:function(n){var t,r=o.D.parse(n),u=r.words;return 1398893684===u[0]&&1701076831===u[1]&&(t=new e.e(u.slice(2,4)),u.splice(0,4),r.nSigBytes-=16),new i.Q({cipherText:r,salt:t})}}},2214:function(n,t,r){r.d(t,{s:function(){return f}});var i=r(3354),e=r(2505),o=r(7008),u=function(){return(u=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},f={execute:function(n,t,r,f,c){f||(f=i.e.random(8));var s=c&&c.kdfModule||o.E,a=c?{Hasher:c.kdfHasher,iterations:c.kdfIterations}:{},h=s.getKey(n,f,u(u({},a),{keySize:t+r})),v=new i.e(h.words.slice(t),4*r);return h.nSigBytes=4*t,new e.Q({key:h,iv:v,salt:f})}}},7008:function(n,t,r){r.d(t,{E:function(){return s}});var i,e=r(5561),o=r(6367),u=r(3354),f=r(9541),c=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),s=function(n){function t(t){var r=n.call(this,t)||this;return r.un=4,r.fn=e.SHA256,r.cn=1e4,t&&(r.un=void 0!==t.keySize?t.keySize:r.un,r.fn=void 0!==t.Hasher?t.Hasher:r.fn,r.cn=void 0!==t.iterations?t.iterations:r.cn),r}return c(t,n),t.prototype.compute=function(n,t){for(var r=new o.Hmac(new this.fn,n),i=new u.e,e=new u.e([1]),f=i.words,c=e.words,s=this.un,a=this.cn;f.length<s;){var h=r.update(t).finalize(e);r.reset();for(var v=h.words,w=v.length,d=h,l=1;l<a;l++){d=r.finalize(d),r.reset();for(var b=d.words,y=0;y<w;y++)v[y]^=b[y]}i.concat(h),c[0]++}return i.nSigBytes=4*s,i},t.getKey=function(n,r,i){return new t(i).compute(n,r)},t}(f._)},9541:function(n,t,r){r.d(t,{_:function(){return i}});var i=function(){function n(n){this.O=n}return n.prototype.compute=function(n,t){throw new Error("Not implemented")},n.getKey=function(n,t,r){throw new Error("Not implemented")},n}()},1863:function(n,t,r){r.d(t,{T:function(){return i}});var i=function(){function n(n){this.O=n,this.sn=n.cipher,this.on=n.iv}return n.prototype.processBlock=function(n,t){},n.createEncryptor=function(n){throw new Error("Not implemented yet")},n.createDecryptor=function(n){throw new Error("Not implemented yet")},n}()},4344:function(n,t,r){r.d(t,{n:function(){return u}});var i,e=r(1863),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.an=[],r}return o(t,n),t.prototype.xorBlock=function(n,t,r){var i,e=this.on;e?(i=e.words,this.on=void 0):i=this.an;for(var o=0;o<r;o++)n[t+o]^=i[o]},t.createEncryptor=function(n){return new t.Encryptor(n)},t.createDecryptor=function(n){return new t.Decryptor(n)},t.Encryptor=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return o(t,n),t.prototype.processBlock=function(n,t){var r=this.sn,i=r.blockSize;this.xorBlock(n,t,i),r.encryptBlock(n,t),this.an=n.slice(t,t+i)},t}(t),t.Decryptor=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return o(t,n),t.prototype.processBlock=function(n,t){var r=this.sn,i=r.blockSize,e=n.slice(t,t+i);r.decryptBlock(n,t),this.xorBlock(n,t,i),this.an=e},t}(t),t}(e.T)},7919:function(n,t,r){r.d(t,{l:function(){return e}});var i=r(3354);var e={pad:function(n,t){for(var r=4*t,e=r-n.nSigBytes%r,o=e<<24|e<<16|e<<8|e,u=[],f=0;f<e;f+=4)u.push(o);var c=new i.e(u,e);n.concat(c)},unpad:function(n){var t=255&n.words[n.nSigBytes-1>>>2];n.nSigBytes-=t}}},1756:function(n,t,r){r.d(t,{w:function(){return u}});var i,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(i=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(i)?(i=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(i)&&i):i);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},1773:function(n,t,r){r.d(t,{D:function(){return f}});for(var i=r(3354),e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=[],u=0;u<e.length;u++)o[e.charCodeAt(u)]=u;var f={stringify:function(n){var t=n.words,r=n.nSigBytes;n.clamp();for(var i=[],o=0;o<r;o+=3)for(var u=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,f=0;f<4&&o+.75*f<r;f++)i.push(e.charAt(u>>>6*(3-f)&63));var c=e.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(n){var t=n.length,r=e.charAt(64);if(r){var u=n.indexOf(r);-1!==u&&(t=u)}for(var f=[],c=0,s=0;s<t;s++)if(s%4){var a=o[n.charCodeAt(s-1)]<<s%4*2|o[n.charCodeAt(s)]>>>6-s%4*2;f[c>>>2]|=a<<24-c%4*8,c++}return new i.e(f,c)}}},5720:function(n,t,r){r.d(t,{p:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],e=0;e<t;e+=2)r[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new i.e(r,t/2)}}},8702:function(n,t,r){r.d(t,{m:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(n){for(var t=n.length,r=[],e=0;e<t;e++)r[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new i.e(r,t)}}},4768:function(n,t,r){r.d(t,{d:function(){return e}});var i=r(8702),e={stringify:function(n){try{return decodeURIComponent(escape(i.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return i.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,r){r.d(t,{M:function(){return e}});var i=r(1756);var e=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,i.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function r(i){var e=t[i];if(void 0!==e)return e.exports;var o=t[i]={exports:{}};return n[i](o,o.exports,r),o.exports}r.d=function(n,t){for(var i in t)r.o(t,i)&&!r.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"hn",{value:!0})};var i={};return function(){r.r(i),r.d(i,{DES3:function(){return h}});var n,t=r(9109),e=r(787),o=r(9456),u=r(9910),f=r(3354),c=r(5693),s=(n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(t,r)},function(t,r){function i(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}),a=function(){return(a=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},h=function(n){function r(t){var r=n.call(this,t)||this;r.i=2,r.O=t;var i=r.vn();return r.wn=i[0],r.dn=i[1],r.ln=i[2],r}return s(r,n),r.prototype.vn=function(){var n=this.k.words;if(2!==n.length&&4!==n.length&&n.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var t=n.slice(0,2),r=n.length<4?n.slice(0,2):n.slice(2,4),i=n.length<6?n.slice(0,2):n.slice(4,6);return[u.DES.createEncryptor(new f.e(t)),u.DES.createEncryptor(new f.e(r)),u.DES.createEncryptor(new f.e(i))]},r.prototype.A=function(){var n=this.vn();this.wn=n[0],this.dn=n[1],this.ln=n[2]},r.prototype.encryptBlock=function(n,t){this.wn.encryptBlock(n,t),this.dn.decryptBlock(n,t),this.ln.encryptBlock(n,t)},r.prototype.decryptBlock=function(n,t){this.ln.decryptBlock(n,t),this.dn.encryptBlock(n,t),this.wn.decryptBlock(n,t)},r.createEncryptor=function(n,t){return new r(a(a({},t=void 0===t?{}:t),{key:n,transformMode:o.t.ENC_TRANSFORM_MODE}))},r.createDecryptor=function(n,t){return new r(a(a({},t=void 0===t?{}:t),{key:n,transformMode:o.t.DEC_TRANSFORM_MODE}))},r.encrypt=function(n,i,e){return"string"==typeof i?c.E.encrypt(r,n,i,e):t.D.encrypt(r,n,i,e)},r.decrypt=function(n,i,e){return"string"==typeof i?c.E.decrypt(r,n,i,e):t.D.decrypt(r,n,i,e)},r.keySize=6,r.ivSize=2,r}(e.G)}(),i}()}));
\ No newline at end of file
... ...
  1 +export { EvpKDF } from "./lib/algorithm/cipher/kdf/module/EvpKDF";
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var i in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[i]=r[i]}}(this,(function(){return function(){"use strict";var n={670:function(n,t,r){r.d(t,{MD5:function(){return v}});var i,e=r(3354),o=r(1868),u=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),f=[];function c(n,t,r,i,e,o,u){var f=n+(t&r|~t&i)+e+u;return(f<<o|f>>>32-o)+t}function a(n,t,r,i,e,o,u){var f=n+(t&i|r&~i)+e+u;return(f<<o|f>>>32-o)+t}function s(n,t,r,i,e,o,u){var f=n+(t^r^i)+e+u;return(f<<o|f>>>32-o)+t}function h(n,t,r,i,e,o,u){var f=n+(r^(t|~i))+e+u;return(f<<o|f>>>32-o)+t}!function(){for(var n=0;n<64;n++)f[n]=4294967296*Math.abs(Math.sin(n+1))|0}();var v=function(n){function t(t){var r=n.call(this,t)||this;return r.t=new e.e([1732584193,4023233417,2562383102,271733878]),t&&void 0!==t.hash&&(r.t=t.hash.clone()),r}return u(t,n),t.prototype.i=function(){this.t=new e.e([1732584193,4023233417,2562383102,271733878])},t.prototype.u=function(n,t){for(var r=0;r<16;r++){var i=t+r,e=n[i];n[i]=16711935&(e<<8|e>>>24)|4278255360&(e<<24|e>>>8)}var o=this.t.words,u=n[t],v=n[t+1],w=n[t+2],d=n[t+3],l=n[t+4],y=n[t+5],b=n[t+6],p=n[t+7],m=n[t+8],g=n[t+9],j=n[t+10],A=n[t+11],O=n[t+12],E=n[t+13],M=n[t+14],_=n[t+15],I=o[0],U=o[1],N=o[2],S=o[3];I=c(I,U,N,S,u,7,f[0]),S=c(S,I,U,N,v,12,f[1]),N=c(N,S,I,U,w,17,f[2]),U=c(U,N,S,I,d,22,f[3]),I=c(I,U,N,S,l,7,f[4]),S=c(S,I,U,N,y,12,f[5]),N=c(N,S,I,U,b,17,f[6]),U=c(U,N,S,I,p,22,f[7]),I=c(I,U,N,S,m,7,f[8]),S=c(S,I,U,N,g,12,f[9]),N=c(N,S,I,U,j,17,f[10]),U=c(U,N,S,I,A,22,f[11]),I=c(I,U,N,S,O,7,f[12]),S=c(S,I,U,N,E,12,f[13]),N=c(N,S,I,U,M,17,f[14]),I=a(I,U=c(U,N,S,I,_,22,f[15]),N,S,v,5,f[16]),S=a(S,I,U,N,b,9,f[17]),N=a(N,S,I,U,A,14,f[18]),U=a(U,N,S,I,u,20,f[19]),I=a(I,U,N,S,y,5,f[20]),S=a(S,I,U,N,j,9,f[21]),N=a(N,S,I,U,_,14,f[22]),U=a(U,N,S,I,l,20,f[23]),I=a(I,U,N,S,g,5,f[24]),S=a(S,I,U,N,M,9,f[25]),N=a(N,S,I,U,d,14,f[26]),U=a(U,N,S,I,m,20,f[27]),I=a(I,U,N,S,E,5,f[28]),S=a(S,I,U,N,w,9,f[29]),N=a(N,S,I,U,p,14,f[30]),I=s(I,U=a(U,N,S,I,O,20,f[31]),N,S,y,4,f[32]),S=s(S,I,U,N,m,11,f[33]),N=s(N,S,I,U,A,16,f[34]),U=s(U,N,S,I,M,23,f[35]),I=s(I,U,N,S,v,4,f[36]),S=s(S,I,U,N,l,11,f[37]),N=s(N,S,I,U,p,16,f[38]),U=s(U,N,S,I,j,23,f[39]),I=s(I,U,N,S,E,4,f[40]),S=s(S,I,U,N,u,11,f[41]),N=s(N,S,I,U,d,16,f[42]),U=s(U,N,S,I,b,23,f[43]),I=s(I,U,N,S,g,4,f[44]),S=s(S,I,U,N,O,11,f[45]),N=s(N,S,I,U,_,16,f[46]),I=h(I,U=s(U,N,S,I,w,23,f[47]),N,S,u,6,f[48]),S=h(S,I,U,N,p,10,f[49]),N=h(N,S,I,U,M,15,f[50]),U=h(U,N,S,I,y,21,f[51]),I=h(I,U,N,S,O,6,f[52]),S=h(S,I,U,N,d,10,f[53]),N=h(N,S,I,U,j,15,f[54]),U=h(U,N,S,I,v,21,f[55]),I=h(I,U,N,S,m,6,f[56]),S=h(S,I,U,N,_,10,f[57]),N=h(N,S,I,U,b,15,f[58]),U=h(U,N,S,I,E,21,f[59]),I=h(I,U,N,S,l,6,f[60]),S=h(S,I,U,N,A,10,f[61]),N=h(N,S,I,U,w,15,f[62]),U=h(U,N,S,I,g,21,f[63]),o[0]=o[0]+I|0,o[1]=o[1]+U|0,o[2]=o[2]+N|0,o[3]=o[3]+S|0},t.prototype.h=function(){var n=this.v,t=n.words,r=8*this.l,i=8*n.nSigBytes;t[i>>>5]|=128<<24-i%32;var e=Math.floor(r/4294967296),o=r;t[15+(i+64>>>9<<4)]=16711935&(e<<8|e>>>24)|4278255360&(e<<24|e>>>8),t[14+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n.nSigBytes=4*(t.length+1),this.j();for(var u=this.t,f=u.words,c=0;c<4;c++){var a=f[c];f[c]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return u},t.prototype.clone=function(){return new t({hash:this.t,blockSize:this.A,data:this.v,nBytes:this.l})},t.hash=function(n){return(new t).finalize(n)},t}(o.P)},3354:function(n,t,r){r.d(t,{e:function(){return o}});var i=r(5720),e=r(9054),o=function(){function n(t,r){if(Array.isArray(t)||!t)return this.O=Array.isArray(t)?t:[],void(this._="number"==typeof r?r:4*this.O.length);if(t instanceof n)return this.O=t.words.slice(),void(this._=t.nSigBytes);var i;try{t instanceof ArrayBuffer?i=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!i)throw new Error("Invalid argument");for(var e=i.byteLength,o=[],u=0;u<e;u++)o[u>>>2]|=i[u]<<24-u%4*8;this.O=o,this._=e}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this._},set:function(n){this._=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.O},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):i.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.O,t=this._,r=new Uint8Array(t),i=0;i<t;i++)r[i]=n[i>>>2]>>>24-i%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this._%4)for(var i=0;i<r;i++){var e=t[i>>>2]>>>24-i%4*8&255;this.O[this._+i>>>2]|=e<<24-(this._+i)%4*8}else for(i=0;i<r;i+=4)this.O[this._+i>>>2]=t[i>>>2];return this._+=r,this},n.prototype.clamp=function(){var n=this._;this.O[n>>>2]&=4294967295<<32-n%4*8,this.O.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.O.slice(),this._)},n.random=function(t){for(var r=[],i=0;i<t;i+=4)r.push((0,e.M)());return new n(r,t)},n}()},7211:function(n,t,r){r.d(t,{C:function(){return o}});var i=r(3354),e=r(4768),o=function(){function n(n){this.I=0,this.A=0,this.U=n,this.v=n&&void 0!==n.data?n.data.clone():new i.e,this.l=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.A},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.v=void 0!==n?n.clone():new i.e,this.l="number"==typeof t?t:0},n.prototype.N=function(n){var t="string"==typeof n?e.d.parse(n):n;this.v.concat(t),this.l+=t.nSigBytes},n.prototype.j=function(n){var t,r=this.v.words,e=this.v.nSigBytes,o=this.A,u=e/(4*this.A),f=(u=n?Math.ceil(u):Math.max((0|u)-this.I,0))*o,c=Math.min(4*f,e);if(f){for(var a=0;a<f;a+=o)this.u(r,a);t=r.splice(0,f),this.v.nSigBytes-=c}return new i.e(t,c)},n.prototype.u=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,r){r.d(t,{P:function(){return u}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.A=16,r.U=t,t&&"number"==typeof t.blockSize&&(r.A=t.blockSize),r.reset(t?t.data:void 0,t?t.nBytes:void 0),r}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.A},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.i()},t.prototype.update=function(n){return this.N(n),this.j(),this},t.prototype.finalize=function(n){return n&&this.N(n),this.h()},t.prototype.i=function(){throw new Error("Not implemented")},t.prototype.h=function(){throw new Error("Not implemented")},t}(e.C)},1756:function(n,t,r){r.d(t,{w:function(){return u}});var i,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(i=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(i)?(i=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(i)&&i):i);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},5720:function(n,t,r){r.d(t,{p:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],e=0;e<t;e+=2)r[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new i.e(r,t/2)}}},8702:function(n,t,r){r.d(t,{m:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(n){for(var t=n.length,r=[],e=0;e<t;e++)r[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new i.e(r,t)}}},4768:function(n,t,r){r.d(t,{d:function(){return e}});var i=r(8702),e={stringify:function(n){try{return decodeURIComponent(escape(i.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return i.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,r){r.d(t,{M:function(){return e}});var i=r(1756);var e=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,i.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function r(i){var e=t[i];if(void 0!==e)return e.exports;var o=t[i]={exports:{}};return n[i](o,o.exports,r),o.exports}r.d=function(n,t){for(var i in t)r.o(t,i)&&!r.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"S",{value:!0})};var i={};return function(){r.r(i),r.d(i,{EvpKDF:function(){return f}});var n,t=r(670),e=r(3354),o=function(){function n(n){this.U=n}return n.prototype.compute=function(n,t){throw new Error("Not implemented")},n.getKey=function(n,t,r){throw new Error("Not implemented")},n}(),u=(n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(t,r)},function(t,r){function i(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}),f=function(n){function r(r){var i=n.call(this,r)||this;return i.F=4,i.k=t.MD5,i.B=1,r&&(i.F=void 0!==r.keySize?r.keySize:i.F,i.k=void 0!==r.Hasher?r.Hasher:i.k,i.B=void 0!==r.iterations?r.iterations:i.B),i}return u(r,n),r.prototype.compute=function(n,t){for(var r,i=new this.k,o=new e.e,u=o.words,f=this.F,c=this.B;u.length<f;){r&&i.update(r),r=i.update(n).finalize(t),i.reset();for(var a=1;a<c;a++)r=i.finalize(r),i.reset();o.concat(r)}return o.nSigBytes=4*f,o},r.getKey=function(n,t,i){return new r(i).compute(n,t)},r}(o)}(),i}()}));
\ No newline at end of file
... ...
  1 +import { Word32Array } from "./lib/Word32Array";
  2 +import { BlockCipher } from "./lib/algorithm/cipher/BlockCipher";
  3 +export declare type GMACProps = {
  4 + Cipher: typeof BlockCipher;
  5 +};
  6 +export declare function GMAC(message: Word32Array | string, key: Word32Array | string, iv?: Word32Array, tagLength?: number, props?: Partial<GMACProps>): Word32Array;
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var i in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[i]=r[i]}}(this,(function(){return function(){"use strict";var n={9691:function(n,t,r){r.d(t,{AES:function(){return O}});var i,e=r(9456),o=r(787),u=r(5693),f=r(9109),c=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),a=function(){return(a=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},s=[],h=[],v=[],w=[],l=[],d=[],b=[],y=[],p=[],m=[];!function(){for(var n=[],t=0;t<256;t++)n[t]=t<128?t<<1:t<<1^283;var r=0,i=0;for(t=0;t<256;t++){var e=i^i<<1^i<<2^i<<3^i<<4;e=e>>>8^255&e^99,s[r]=e,h[e]=r;var o=n[r],u=n[o],f=n[u],c=257*n[e]^16843008*e;v[r]=c<<24|c>>>8,w[r]=c<<16|c>>>16,l[r]=c<<8|c>>>24,d[r]=c,c=16843009*f^65537*u^257*o^16843008*r,b[e]=c<<24|c>>>8,y[e]=c<<16|c>>>16,p[e]=c<<8|c>>>24,m[e]=c,r?(r=o^n[n[n[f^o]]],i^=n[n[i]]):r=i=1}}();var j=[0,1,2,4,8,16,32,64,128,27,54],O=function(n){function t(t){var r=n.call(this,t)||this;return r.i=0,r.u=[],r.h=[],r.v=t,r.j(),r}return c(t,n),t.prototype.j=function(){var n;if(!this.i||this.O!==this.A){for(var t=this.O=this.A,r=t.words,i=t.nSigBytes/4,e=4*((this.i=i+6)+1),o=this.u=[],u=0;u<e;u++)u<i?o[u]=r[u]:(n=o[u-1],u%i?i>6&&u%i==4&&(n=s[n>>>24]<<24|s[n>>>16&255]<<16|s[n>>>8&255]<<8|s[255&n]):(n=s[(n=n<<8|n>>>24)>>>24]<<24|s[n>>>16&255]<<16|s[n>>>8&255]<<8|s[255&n],n^=j[u/i|0]<<24),o[u]=o[u-i]^n);this.h=[];for(var f=0;f<e;f++){u=e-f;n=f%4?o[u]:o[u-4],this.h[f]=f<4||u<=4?n:b[s[n>>>24]]^y[s[n>>>16&255]]^p[s[n>>>8&255]]^m[s[255&n]]}}},t.prototype.encryptBlock=function(n,t){this.k(n,t,this.u,v,w,l,d,s)},t.prototype.decryptBlock=function(n,t){var r=n[t+1];n[t+1]=n[t+3],n[t+3]=r,this.k(n,t,this.h,b,y,p,m,h),r=n[t+1],n[t+1]=n[t+3],n[t+3]=r},t.prototype.k=function(n,t,r,i,e,o,u,f){for(var c=this.i,a=n[t]^r[0],s=n[t+1]^r[1],h=n[t+2]^r[2],v=n[t+3]^r[3],w=4,l=1;l<c;l++){var d=i[a>>>24]^e[s>>>16&255]^o[h>>>8&255]^u[255&v]^r[w++],b=i[s>>>24]^e[h>>>16&255]^o[v>>>8&255]^u[255&a]^r[w++],y=i[h>>>24]^e[v>>>16&255]^o[a>>>8&255]^u[255&s]^r[w++],p=i[v>>>24]^e[a>>>16&255]^o[s>>>8&255]^u[255&h]^r[w++];a=d,s=b,h=y,v=p}var m=(f[a>>>24]<<24|f[s>>>16&255]<<16|f[h>>>8&255]<<8|f[255&v])^r[w++],j=(f[s>>>24]<<24|f[h>>>16&255]<<16|f[v>>>8&255]<<8|f[255&a])^r[w++],O=(f[h>>>24]<<24|f[v>>>16&255]<<16|f[a>>>8&255]<<8|f[255&s])^r[w++],g=(f[v>>>24]<<24|f[a>>>16&255]<<16|f[s>>>8&255]<<8|f[255&h])^r[w++];n[t]=m,n[t+1]=j,n[t+2]=O,n[t+3]=g},t.createEncryptor=function(n,r){return new t(a(a({},r=void 0===r?{}:r),{key:n,transformMode:e.t.ENC_TRANSFORM_MODE}))},t.createDecryptor=function(n,r){return new t(a(a({},r=void 0===r?{}:r),{key:n,transformMode:e.t.DEC_TRANSFORM_MODE}))},t.encrypt=function(n,r,i){if("string"==typeof r)return u.E.encrypt(t,n,r,i);if(r.nSigBytes%4!=0)throw new Error("Key size must be multiple of 32bit/4byte/1word");return f.D.encrypt(t,n,r,i)},t.decrypt=function(n,r,i){if("string"==typeof r)return u.E.decrypt(t,n,r,i);if(r.nSigBytes%4!=0)throw new Error("Key size must be multiple of 32bit/4byte/1word");return f.D.decrypt(t,n,r,i)},t.keySize=8,t}(o.G)},6367:function(n,t,r){r.d(t,{Hmac:function(){return e}});var i=r(4768),e=function(){function n(n,t){this.I=n,"string"==typeof t&&(t=i.d.parse(t));var r=n.blockSize,e=4*r;t.nSigBytes>e&&(t=n.finalize(t)),t.clamp();for(var o=this.N=t.clone(),u=this.S=t.clone(),f=o.words,c=u.words,a=0;a<r;a++)f[a]^=1549556828,c[a]^=909522486;u.nSigBytes=e,o.nSigBytes=e,this.reset()}return n.prototype.reset=function(){this.I.reset(),this.I.update(this.S)},n.prototype.update=function(n){return this.I.update(n),this},n.prototype.finalize=function(n){var t=this.I.finalize(n);return this.I.reset(),this.I.finalize(this.N.clone().concat(t))},n}()},5561:function(n,t,r){r.d(t,{SHA256:function(){return v}});var i,e=r(1868),o=r(3354),u=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),f=[],c=[];function a(n){for(var t=Math.sqrt(n),r=2;r<=t;r++)if(!(n%r))return!1;return!0}function s(n){return 4294967296*(n-(0|n))|0}!function(){for(var n=2,t=0;t<64;)a(n)&&(t<8&&(f[t]=s(Math.pow(n,.5))),c[t]=s(Math.pow(n,1/3)),t++),n++}();var h=[],v=function(n){function t(t){var r=n.call(this,t)||this;return r.U=new o.e(f.slice(0)),r.v=t,t&&void 0!==t.hash&&(r.U=t.hash.clone()),r}return u(t,n),t.prototype.j=function(){this.U=new o.e(f.slice(0))},t.prototype.H=function(n,t){for(var r=this.U.words,i=r[0],e=r[1],o=r[2],u=r[3],f=r[4],a=r[5],s=r[6],v=r[7],w=0;w<64;w++){if(w<16)h[w]=0|n[t+w];else{var l=h[w-15],d=(l<<25|l>>>7)^(l<<14|l>>>18)^l>>>3,b=h[w-2],y=(b<<15|b>>>17)^(b<<13|b>>>19)^b>>>10;h[w]=d+h[w-7]+y+h[w-16]}var p=i&e^i&o^e&o,m=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),j=v+((f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25))+(f&a^~f&s)+c[w]+h[w];v=s,s=a,a=f,f=u+j|0,u=o,o=e,e=i,i=j+(m+p)|0}r[0]=r[0]+i|0,r[1]=r[1]+e|0,r[2]=r[2]+o|0,r[3]=r[3]+u|0,r[4]=r[4]+f|0,r[5]=r[5]+a|0,r[6]=r[6]+s|0,r[7]=r[7]+v|0},t.prototype.F=function(){var n=this.B.words,t=8*this.K,r=8*this.B.nSigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=Math.floor(t/4294967296),n[15+(r+64>>>9<<4)]=t,this.B.nSigBytes=4*n.length,this.L(),this.U},t.prototype.clone=function(){return new t({hash:this.U,blockSize:this.R,data:this.B,nBytes:this.K})},t.hash=function(n,r){return new t(r).finalize(n)},t}(e.P)},3354:function(n,t,r){r.d(t,{e:function(){return o}});var i=r(5720),e=r(9054),o=function(){function n(t,r){if(Array.isArray(t)||!t)return this.q=Array.isArray(t)?t:[],void(this.X="number"==typeof r?r:4*this.q.length);if(t instanceof n)return this.q=t.words.slice(),void(this.X=t.nSigBytes);var i;try{t instanceof ArrayBuffer?i=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!i)throw new Error("Invalid argument");for(var e=i.byteLength,o=[],u=0;u<e;u++)o[u>>>2]|=i[u]<<24-u%4*8;this.q=o,this.X=e}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.X},set:function(n){this.X=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.q},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):i.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.q,t=this.X,r=new Uint8Array(t),i=0;i<t;i++)r[i]=n[i>>>2]>>>24-i%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.X%4)for(var i=0;i<r;i++){var e=t[i>>>2]>>>24-i%4*8&255;this.q[this.X+i>>>2]|=e<<24-(this.X+i)%4*8}else for(i=0;i<r;i+=4)this.q[this.X+i>>>2]=t[i>>>2];return this.X+=r,this},n.prototype.clamp=function(){var n=this.X;this.q[n>>>2]&=4294967295<<32-n%4*8,this.q.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.q.slice(),this.X)},n.random=function(t){for(var r=[],i=0;i<t;i+=4)r.push((0,e.M)());return new n(r,t)},n}()},7211:function(n,t,r){r.d(t,{C:function(){return o}});var i=r(3354),e=r(4768),o=function(){function n(n){this.J=0,this.R=0,this.v=n,this.B=n&&void 0!==n.data?n.data.clone():new i.e,this.K=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.R},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.B=void 0!==n?n.clone():new i.e,this.K="number"==typeof t?t:0},n.prototype.Y=function(n){var t="string"==typeof n?e.d.parse(n):n;this.B.concat(t),this.K+=t.nSigBytes},n.prototype.L=function(n){var t,r=this.B.words,e=this.B.nSigBytes,o=this.R,u=e/(4*this.R),f=(u=n?Math.ceil(u):Math.max((0|u)-this.J,0))*o,c=Math.min(4*f,e);if(f){for(var a=0;a<f;a+=o)this.H(r,a);t=r.splice(0,f),this.B.nSigBytes-=c}return new i.e(t,c)},n.prototype.H=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,r){r.d(t,{P:function(){return u}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.R=16,r.v=t,t&&"number"==typeof t.blockSize&&(r.R=t.blockSize),r.reset(t?t.data:void 0,t?t.nBytes:void 0),r}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.R},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.j()},t.prototype.update=function(n){return this.Y(n),this.L(),this},t.prototype.finalize=function(n){return n&&this.Y(n),this.F()},t.prototype.j=function(){throw new Error("Not implemented")},t.prototype.F=function(){throw new Error("Not implemented")},t}(e.C)},787:function(n,t,r){r.d(t,{G:function(){return a}});var i,e=r(9456),o=r(4344),u=r(7919),f=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),c=function(){return(c=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},a=function(n){function t(t){var r=n.call(this,t)||this;return r.R=4,r.Z=o.n,r.$=u.l,r.v=t,r.Z=void 0!==t.mode?t.mode:r.Z,r.$=void 0!==t.padding?t.padding:r.$,r.reset(null==t?void 0:t.data,null==t?void 0:t.nBytes),r}return f(t,n),Object.defineProperty(t.prototype,"mode",{get:function(){return this.nn},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"padding",{get:function(){return this.$},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){var i;n.prototype.reset.call(this,t,r),this.tn===e.t.ENC_TRANSFORM_MODE?i=this.Z.createEncryptor:(i=this.Z.createDecryptor,this.J=1),this.Z&&this.rn===i?this.nn=new this.Z({cipher:this,iv:this.en}):(this.nn=i.call(this.Z,{cipher:this,iv:this.en}),this.rn=i)},t.prototype.H=function(n,t){var r;null===(r=this.nn)||void 0===r||r.processBlock(n,t)},t.prototype.F=function(){var n,t=this.$;return this.tn===e.t.ENC_TRANSFORM_MODE?(t.pad(this.B,this.blockSize),n=this.L(!0)):(n=this.L(!0),t.unpad(n)),n},t.prototype.encryptBlock=function(n,t){throw new Error("Not implemented")},t.prototype.decryptBlock=function(n,t){throw new Error("Not implemented")},t.createEncryptor=function(n,r){return new t(c(c({},r=void 0===r?{}:r),{key:n,transformMode:e.t.ENC_TRANSFORM_MODE}))},t.createDecryptor=function(n,r){return new t(c(c({},r=void 0===r?{}:r),{key:n,transformMode:e.t.DEC_TRANSFORM_MODE}))},t}(e.t)},9456:function(n,t,r){r.d(t,{t:function(){return f}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(){return(u=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},f=function(n){function t(t){var r=n.call(this,t)||this;return r.tn=1,r.v=t,r.A=t.key,r.en=void 0!==t.iv?t.iv:r.en,r.tn=void 0!==t.transformMode?t.transformMode:r.tn,r}return o(t,n),Object.defineProperty(t.prototype,"iv",{get:function(){return this.en},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.j()},t.prototype.process=function(n){return this.Y(n),this.L()},t.prototype.finalize=function(n){return n&&this.Y(n),this.F()},t.prototype.j=function(){throw new Error("Not implemented")},t.prototype.H=function(n,t){throw new Error("Not implemented")},t.prototype.F=function(){throw new Error("Not implemented")},t.createEncryptor=function(n,r){return new t(u(u({},r=void 0===r?{}:r),{key:n,transformMode:t.ENC_TRANSFORM_MODE}))},t.createDecryptor=function(n,r){return new t(u(u({},r=void 0===r?{}:r),{key:n,transformMode:t.DEC_TRANSFORM_MODE}))},t.ENC_TRANSFORM_MODE=1,t.DEC_TRANSFORM_MODE=2,t.keySize=4,t.ivSize=4,t}(e.C)},2505:function(n,t,r){r.d(t,{Q:function(){return e}});var i=r(1232),e=function(){function n(n){this.formatter=i.w,n&&(this.cipherText=n.cipherText,this.key=n.key,this.iv=n.iv,this.salt=n.salt,this.Algorithm=n.Algorithm,this.mode=n.mode,this.padding=n.padding,this.blockSize=n.blockSize,this.formatter=n.formatter||i.w)}return n.prototype.toString=function(n){return(n||this.formatter).stringify(this)},n}()},5693:function(n,t,r){r.d(t,{E:function(){return c}});var i=r(9109),e=r(2214),o=r(2505),u=r(1232),f=function(){return(f=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},c={encrypt:function(n,t,r,u){var c=u?f({},u):{},a=u&&u.KDF?u.KDF:e.s,s={};u&&u.kdfHasher&&(s.kdfHasher=u.kdfHasher),u&&u.kdfIterations&&(s.kdfIterations=u.kdfIterations),u&&u.kdfModule&&(s.kdfModule=u.kdfModule);var h=a.execute(r,n.keySize,n.ivSize,c.kdfSalt,s);c.iv=h.iv;var v=i.D.encrypt(n,t,h.key,c);return new o.Q(f(f({},v),{key:h.key,iv:h.iv,salt:h.salt}))},decrypt:function(n,t,r,o){var c=o?f({},o):{},a=c.KDF?c.KDF:e.s,s=c.formatter?c.formatter:u.w,h=(0,i.W)(t,s),v={};o&&o.kdfHasher&&(v.kdfHasher=o.kdfHasher),o&&o.kdfIterations&&(v.kdfIterations=o.kdfIterations),o&&o.kdfModule&&(v.kdfModule=o.kdfModule);var w=a.execute(r,n.keySize,n.ivSize,h.salt,v);return c.iv=w.iv,i.D.decrypt(n,h,w.key,c)}}},9109:function(n,t,r){r.d(t,{W:function(){return o},D:function(){return u}});var i=r(1232),e=r(2505);function o(n,t){return"string"==typeof n?t.parse(n):n}var u={encrypt:function(n,t,r,o){var u=n.createEncryptor(r,o),f=u.finalize(t);return new e.Q({cipherText:f,key:r,iv:u.iv,Algorithm:n,mode:u.mode,padding:u.padding,blockSize:u.blockSize,formatter:(null==o?void 0:o.formatter)||i.w})},decrypt:function(n,t,r,e){var u=n.createDecryptor(r,e),f=o(t,(null==e?void 0:e.formatter)||i.w);return u.finalize(f.cipherText||"")}}},1232:function(n,t,r){r.d(t,{w:function(){return u}});var i=r(2505),e=r(3354),o=r(1773),u={stringify:function(n){var t=n.cipherText,r=n.salt;return t?r?new e.e([1398893684,1701076831]).concat(r).concat(t).toString(o.D):t.toString(o.D):""},parse:function(n){var t,r=o.D.parse(n),u=r.words;return 1398893684===u[0]&&1701076831===u[1]&&(t=new e.e(u.slice(2,4)),u.splice(0,4),r.nSigBytes-=16),new i.Q({cipherText:r,salt:t})}}},2214:function(n,t,r){r.d(t,{s:function(){return f}});var i=r(3354),e=r(2505),o=r(7008),u=function(){return(u=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},f={execute:function(n,t,r,f,c){f||(f=i.e.random(8));var a=c&&c.kdfModule||o.E,s=c?{Hasher:c.kdfHasher,iterations:c.kdfIterations}:{},h=a.getKey(n,f,u(u({},s),{keySize:t+r})),v=new i.e(h.words.slice(t),4*r);return h.nSigBytes=4*t,new e.Q({key:h,iv:v,salt:f})}}},7008:function(n,t,r){r.d(t,{E:function(){return a}});var i,e=r(5561),o=r(6367),u=r(3354),f=r(9541),c=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),a=function(n){function t(t){var r=n.call(this,t)||this;return r.on=4,r.un=e.SHA256,r.fn=1e4,t&&(r.on=void 0!==t.keySize?t.keySize:r.on,r.un=void 0!==t.Hasher?t.Hasher:r.un,r.fn=void 0!==t.iterations?t.iterations:r.fn),r}return c(t,n),t.prototype.compute=function(n,t){for(var r=new o.Hmac(new this.un,n),i=new u.e,e=new u.e([1]),f=i.words,c=e.words,a=this.on,s=this.fn;f.length<a;){var h=r.update(t).finalize(e);r.reset();for(var v=h.words,w=v.length,l=h,d=1;d<s;d++){l=r.finalize(l),r.reset();for(var b=l.words,y=0;y<w;y++)v[y]^=b[y]}i.concat(h),c[0]++}return i.nSigBytes=4*a,i},t.getKey=function(n,r,i){return new t(i).compute(n,r)},t}(f._)},9541:function(n,t,r){r.d(t,{_:function(){return i}});var i=function(){function n(n){this.v=n}return n.prototype.compute=function(n,t){throw new Error("Not implemented")},n.getKey=function(n,t,r){throw new Error("Not implemented")},n}()},1863:function(n,t,r){r.d(t,{T:function(){return i}});var i=function(){function n(n){this.v=n,this.cn=n.cipher,this.en=n.iv}return n.prototype.processBlock=function(n,t){},n.createEncryptor=function(n){throw new Error("Not implemented yet")},n.createDecryptor=function(n){throw new Error("Not implemented yet")},n}()},4344:function(n,t,r){r.d(t,{n:function(){return u}});var i,e=r(1863),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.an=[],r}return o(t,n),t.prototype.xorBlock=function(n,t,r){var i,e=this.en;e?(i=e.words,this.en=void 0):i=this.an;for(var o=0;o<r;o++)n[t+o]^=i[o]},t.createEncryptor=function(n){return new t.Encryptor(n)},t.createDecryptor=function(n){return new t.Decryptor(n)},t.Encryptor=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return o(t,n),t.prototype.processBlock=function(n,t){var r=this.cn,i=r.blockSize;this.xorBlock(n,t,i),r.encryptBlock(n,t),this.an=n.slice(t,t+i)},t}(t),t.Decryptor=function(n){function t(){return null!==n&&n.apply(this,arguments)||this}return o(t,n),t.prototype.processBlock=function(n,t){var r=this.cn,i=r.blockSize,e=n.slice(t,t+i);r.decryptBlock(n,t),this.xorBlock(n,t,i),this.an=e},t}(t),t}(e.T)},4055:function(n,t,r){r.d(t,{I4:function(){return e},z6:function(){return o}});var i=r(3354);function e(n){var t=n.nSigBytes%16;if(0!==t){for(var r=16-t,e=[],o=Math.floor(r/4),u=0;u<o;u++)e.push(0);r%4>0&&e.push(0),n.concat(new i.e(e,r))}}function o(n,t){return new i.e(n.words.slice(),t)}},7919:function(n,t,r){r.d(t,{l:function(){return e}});var i=r(3354);var e={pad:function(n,t){for(var r=4*t,e=r-n.nSigBytes%r,o=e<<24|e<<16|e<<8|e,u=[],f=0;f<e;f+=4)u.push(o);var c=new i.e(u,e);n.concat(c)},unpad:function(n){var t=255&n.words[n.nSigBytes-1>>>2];n.nSigBytes-=t}}},1756:function(n,t,r){r.d(t,{w:function(){return u}});var i,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(i=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(i)?(i=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(i)&&i):i);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},1773:function(n,t,r){r.d(t,{D:function(){return f}});for(var i=r(3354),e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=[],u=0;u<e.length;u++)o[e.charCodeAt(u)]=u;var f={stringify:function(n){var t=n.words,r=n.nSigBytes;n.clamp();for(var i=[],o=0;o<r;o+=3)for(var u=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,f=0;f<4&&o+.75*f<r;f++)i.push(e.charAt(u>>>6*(3-f)&63));var c=e.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(n){var t=n.length,r=e.charAt(64);if(r){var u=n.indexOf(r);-1!==u&&(t=u)}for(var f=[],c=0,a=0;a<t;a++)if(a%4){var s=o[n.charCodeAt(a-1)]<<a%4*2|o[n.charCodeAt(a)]>>>6-a%4*2;f[c>>>2]|=s<<24-c%4*8,c++}return new i.e(f,c)}}},5720:function(n,t,r){r.d(t,{p:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],e=0;e<t;e+=2)r[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new i.e(r,t/2)}}},8702:function(n,t,r){r.d(t,{m:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(n){for(var t=n.length,r=[],e=0;e<t;e++)r[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new i.e(r,t)}}},4768:function(n,t,r){r.d(t,{d:function(){return e}});var i=r(8702),e={stringify:function(n){try{return decodeURIComponent(escape(i.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return i.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,r){r.d(t,{M:function(){return e}});var i=r(1756);var e=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,i.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()},5607:function(n,t,r){r.d(t,{V:function(){return c}});var i,e=r(1863),o=r(3354),u=r(4055),f=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),c=function(n){function t(r){var i=n.call(this,r)||this;if(i.sn=[],i.hn=[],i.vn=[],4!==r.cipher.blockSize)throw new Error("In GCM block cipher mode, cipher block size must be 128bit");var e=r.cipher,o=r.iv,u=[0,0,0,0];return e.encryptBlock(u,0),i.sn=u,i.hn=t.getJ0(u,null==o?void 0:o.words),i.vn=i.hn.slice(),i}return f(t,n),t.getJ0=function(n,r){var i;if(r&&0!==r.length)if(3===r.length)i=[r[0],r[1],r[2],1];else{for(var e=r.length%4>0?4-r.length%4:0,o=r.slice(),u=0;u<e+2;u++)o.push(0);o.push(0),o.push(32*r.length),i=t.GHASH(n,o)}else i=[0,0,0,1];return i},t.inc32=function(n){var t=n.slice(),r=t[3]>>>0,i=r+1>>>0<r;if(t[3]=t[3]+1|0,i){var e=t[2]>>>0,o=e+1>>>0<e;t[2]=t[2]+1|0,o&&(t[1]=t[1]+1|0)}return t},t.mul=function(n,t){for(var r=[3774873600,0,0,0],i=[0,0,0,0],e=t.slice(),o=0;o<128;o++){(n[o>>>5]>>>31-o%32&1)>0&&(i[0]=i[0]^e[0],i[1]=i[1]^e[1],i[2]=i[2]^e[2],i[3]=i[3]^e[3]);var u=(1&e[3])>>>0,f=(1&e[0])>>>0,c=(1&e[1])>>>0,a=(1&e[2])>>>0;e[0]=e[0]>>>1,e[1]=e[1]>>>1|(f?2147483648:0),e[2]=e[2]>>>1|(c?2147483648:0),e[3]=e[3]>>>1|(a?2147483648:0),u>0&&(e[0]^=r[0],e[1]^=r[1],e[2]^=r[2],e[3]^=r[3])}return i},t.GHASH=function(n,r){if(n.length%4!=0)throw new Error("Length of 32bit word array 'H' must be multiple of 4(128bit)");if(r.length%4!=0)throw new Error("Length of 32bit word array 'X' must be multiple of 4(128bit)");for(var i=r.length,e=[0,0,0,0],o=0;o<i;o+=4)e[0]=e[0]^r[o],e[1]=e[1]^r[o+1],e[2]=e[2]^r[o+2],e[3]=e[3]^r[o+3],e=t.mul(e,n);return e},t.GCTR=function(n,r,i){if(0===i.nSigBytes)return i.clone();if(4!==r.length)throw new Error("Initial Counter Block size must be 128bit");for(var e=i.words,u=Math.ceil(i.nSigBytes/16),f=[r.slice()],c=1;c<u;c++){var a=t.inc32(f[c-1]);f.push(a)}var s=new o.e;for(c=0;c<u;c++){n.encryptBlock(f[c],0);var h=i.nSigBytes%16;if(c<u-1||0===h){var v=e[4*c]^f[c][0],w=e[4*c+1]^f[c][1],l=e[4*c+2]^f[c][2],d=e[4*c+3]^f[c][3],b=new o.e([v,w,l,d]);s.concat(b)}else{for(var y=[],p=0,m=Math.floor(h/4),j=0;j<m;j++){var O=e[4*c+j]^f[c][j];y.push(O),p+=4}var g=h%4;if(g>0){var _=e[4*c+m]<<32-8*g^f[c][m];y.push(_),p+=g}var A=new o.e(y,p);s.concat(A)}}return s.nSigBytes=i.nSigBytes,s.clamp(),s},t.mac=function(n,r,i,e,f,c){var a=new n({key:r,iv:i}),s=[0,0,0,0];a.encryptBlock(s,0);var h=t.getJ0(s,i.words),v=(null==e?void 0:e.clone())||new o.e,w=[0,8*v.nSigBytes],l=(null==f?void 0:f.clone())||new o.e,d=[0,8*l.nSigBytes],b=c||16;(0,u.I4)(v),(0,u.I4)(l);var y=v.words.concat(l.words).concat(w).concat(d),p=t.GHASH(s,y),m=t.GCTR(a,h,new o.e(p));return(0,u.z6)(m,b)},t.createEncryptor=function(n){return new t.Encryptor(n)},t.createDecryptor=function(n){return new t.Decryptor(n)},t.Encryptor=function(n){function r(){return null!==n&&n.apply(this,arguments)||this}return f(r,n),r.prototype.processBlock=function(n,r){var i=this.cn.blockSize;this.vn=t.inc32(this.vn);for(var e=new o.e(n.slice(r,r+i)),u=t.GCTR(this.cn,this.vn,e),f=0;f<i;f++)n[r+f]=u.words[f]},r}(t),t.Decryptor=function(n){function r(){return null!==n&&n.apply(this,arguments)||this}return f(r,n),r.prototype.processBlock=function(n,r){var i=this.cn.blockSize;this.vn=t.inc32(this.vn);for(var e=new o.e(n.slice(r,r+i)),u=t.GCTR(this.cn,this.vn,e),f=0;f<i;f++)n[r+f]=u.words[f]},r}(t),t}(e.T)}},t={};function r(i){var e=t[i];if(void 0!==e)return e.exports;var o=t[i]={exports:{}};return n[i](o,o.exports,r),o.exports}r.d=function(n,t){for(var i in t)r.o(t,i)&&!r.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"wn",{value:!0})};var i={};return function(){r.r(i),r.d(i,{GMAC:function(){return u}});var n=r(4768),t=r(3354),e=r(9691),o=r(5607);function u(r,i,u,f,c){var a="string"==typeof r?n.d.parse(r):r,s=u||new t.e([0,0,0,0]),h=c&&c.Cipher?c.Cipher:e.AES,v="string"==typeof i?n.d.parse(i):i,w=f||16;return o.V.mac(h,v,s,a,void 0,w)}}(),i}()}));
\ No newline at end of file
... ...
  1 +export { Hex } from "./lib/encoder/Hex";
... ...
  1 +!function(n,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r();else if("function"==typeof define&&define.amd)define([],r);else if("object"==typeof exports)exports.JsCrypto=r();else{var t=r();for(var e in n.JsCrypto=n.JsCrypto||{},t)n.JsCrypto[e]=t[e]}}(this,(function(){return function(){"use strict";var n={d:function(r,t){for(var e in t)n.o(t,e)&&!n.o(r,e)&&Object.defineProperty(r,e,{enumerable:!0,get:t[e]})}};n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),n.o=function(n,r){return Object.prototype.hasOwnProperty.call(n,r)},n.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"t",{value:!0})};var r={};n.r(r),n.d(r,{Hex:function(){return f}});var t,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",i=(t=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(t)?(t=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(t)&&t):t);var o=function(){if("undefined"!=typeof window){var r=window.crypto||window.msCrypto;if(!r){if(function(n,r){return!1!==i&&(!r||("<"===n?i<r:"<="===n?i<=r:">"===n?i>r:">="===n?i>=r:i===r))}("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return r.getRandomValues(new Uint32Array(1))[0]}}return void 0!==n.g&&n.g.crypto?function(){return n.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}(),a=function(){function n(r,t){if(Array.isArray(r)||!r)return this.i=Array.isArray(r)?r:[],void(this.u="number"==typeof t?t:4*this.i.length);if(r instanceof n)return this.i=r.words.slice(),void(this.u=r.nSigBytes);var e;try{r instanceof ArrayBuffer?e=new Uint8Array(r):(r instanceof Uint8Array||r instanceof Int8Array||r instanceof Uint8ClampedArray||r instanceof Int16Array||r instanceof Uint16Array||r instanceof Int32Array||r instanceof Uint32Array||r instanceof Float32Array||r instanceof Float64Array)&&(e=new Uint8Array(r.buffer,r.byteOffset,r.byteLength))}catch(n){throw new Error("Invalid argument")}if(!e)throw new Error("Invalid argument");for(var i=e.byteLength,o=[],a=0;a<i;a++)o[a>>>2]|=e[a]<<24-a%4*8;this.i=o,this.u=i}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.u},set:function(n){this.u=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.i},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):f.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.i,r=this.u,t=new Uint8Array(r),e=0;e<r;e++)t[e]=n[e>>>2]>>>24-e%4*8&255;return t},n.prototype.concat=function(n){var r=n.words.slice(),t=n.nSigBytes;if(this.clamp(),this.u%4)for(var e=0;e<t;e++){var i=r[e>>>2]>>>24-e%4*8&255;this.i[this.u+e>>>2]|=i<<24-(this.u+e)%4*8}else for(e=0;e<t;e+=4)this.i[this.u+e>>>2]=r[e>>>2];return this.u+=t,this},n.prototype.clamp=function(){var n=this.u;this.i[n>>>2]&=4294967295<<32-n%4*8,this.i.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.i.slice(),this.u)},n.random=function(r){for(var t=[],e=0;e<r;e+=4)t.push(o());return new n(t,r)},n}(),f={stringify:function(n){for(var r=n.nSigBytes,t=n.words,e=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;e.push((o>>>4).toString(16)),e.push((15&o).toString(16))}return e.join("")},parse:function(n){var r=n.length;if(r%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var t=[],e=0;e<r;e+=2)t[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new a(t,r/2)}};return r}()}));
\ No newline at end of file
... ...
  1 +import type { Hasher } from "./lib/algorithm/Hasher";
  2 +import type { Word32Array } from "./lib/Word32Array";
  3 +export declare class Hmac {
  4 + private _hasher;
  5 + private _oKey;
  6 + private _iKey;
  7 + constructor(hasher: Hasher, key: Word32Array | string);
  8 + /**
  9 + * Resets this Hmac to its initial state.
  10 + *
  11 + * @example
  12 + * hmacHasher.reset();
  13 + */
  14 + reset(): void;
  15 + /**
  16 + * Updates this Hmac with a message.
  17 + *
  18 + * @param {Word32Array|string} messageUpdate The message to append.
  19 + * @return {Hmac} This Hmac instance.
  20 + * @example
  21 + * hmacHasher.update('message');
  22 + * hmacHasher.update(wordArray);
  23 + */
  24 + update(messageUpdate: Word32Array | string): this;
  25 + /**
  26 + * Finalizes the Hmac computation.
  27 + * Note that the finalize operation is effectively a destructive, read-once operation.
  28 + *
  29 + * @param {Word32Array|string} messageUpdate (Optional) A final message update.
  30 + * @return {Word32Array} The Hmac.
  31 + * @example
  32 + * var hmac = hmacHasher.finalize();
  33 + * var hmac = hmacHasher.finalize('message');
  34 + * var hmac = hmacHasher.finalize(wordArray);
  35 + */
  36 + finalize(messageUpdate: Word32Array | string): Word32Array;
  37 +}
... ...
  1 +!function(n,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r();else if("function"==typeof define&&define.amd)define([],r);else if("object"==typeof exports)exports.JsCrypto=r();else{var t=r();for(var e in n.JsCrypto=n.JsCrypto||{},t)n.JsCrypto[e]=t[e]}}(this,(function(){return function(){"use strict";var n={3354:function(n,r,t){t.d(r,{e:function(){return o}});var e=t(5720),i=t(9054),o=function(){function n(r,t){if(Array.isArray(r)||!r)return this.t=Array.isArray(r)?r:[],void(this.i="number"==typeof t?t:4*this.t.length);if(r instanceof n)return this.t=r.words.slice(),void(this.i=r.nSigBytes);var e;try{r instanceof ArrayBuffer?e=new Uint8Array(r):(r instanceof Uint8Array||r instanceof Int8Array||r instanceof Uint8ClampedArray||r instanceof Int16Array||r instanceof Uint16Array||r instanceof Int32Array||r instanceof Uint32Array||r instanceof Float32Array||r instanceof Float64Array)&&(e=new Uint8Array(r.buffer,r.byteOffset,r.byteLength))}catch(n){throw new Error("Invalid argument")}if(!e)throw new Error("Invalid argument");for(var i=e.byteLength,o=[],u=0;u<i;u++)o[u>>>2]|=e[u]<<24-u%4*8;this.t=o,this.i=i}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.i},set:function(n){this.i=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.t},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):e.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.t,r=this.i,t=new Uint8Array(r),e=0;e<r;e++)t[e]=n[e>>>2]>>>24-e%4*8&255;return t},n.prototype.concat=function(n){var r=n.words.slice(),t=n.nSigBytes;if(this.clamp(),this.i%4)for(var e=0;e<t;e++){var i=r[e>>>2]>>>24-e%4*8&255;this.t[this.i+e>>>2]|=i<<24-(this.i+e)%4*8}else for(e=0;e<t;e+=4)this.t[this.i+e>>>2]=r[e>>>2];return this.i+=t,this},n.prototype.clamp=function(){var n=this.i;this.t[n>>>2]&=4294967295<<32-n%4*8,this.t.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.t.slice(),this.i)},n.random=function(r){for(var t=[],e=0;e<r;e+=4)t.push((0,i.M)());return new n(t,r)},n}()},1756:function(n,r,t){t.d(r,{w:function(){return u}});var e,i="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(e=parseInt((/msie (\d+)/.exec(i)||[])[1],10),isNaN(e)?(e=parseInt((/trident\/.*; rv:(\d+)/.exec(i)||[])[1],10),!isNaN(e)&&e):e);function u(n,r){return!1!==o&&(!r||("<"===n?o<r:"<="===n?o<=r:">"===n?o>r:">="===n?o>=r:o===r))}},5720:function(n,r,t){t.d(r,{p:function(){return i}});var e=t(3354),i={stringify:function(n){for(var r=n.nSigBytes,t=n.words,e=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;e.push((o>>>4).toString(16)),e.push((15&o).toString(16))}return e.join("")},parse:function(n){var r=n.length;if(r%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var t=[],i=0;i<r;i+=2)t[i>>>3]|=parseInt(n.substr(i,2),16)<<24-i%8*4;return new e.e(t,r/2)}}},8702:function(n,r,t){t.d(r,{m:function(){return i}});var e=t(3354),i={stringify:function(n){for(var r=n.nSigBytes,t=n.words,e=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;e.push(String.fromCharCode(o))}return e.join("")},parse:function(n){for(var r=n.length,t=[],i=0;i<r;i++)t[i>>>2]|=(255&n.charCodeAt(i))<<24-i%4*8;return new e.e(t,r)}}},4768:function(n,r,t){t.d(r,{d:function(){return i}});var e=t(8702),i={stringify:function(n){try{return decodeURIComponent(escape(e.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return e.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,r,t){t.d(r,{M:function(){return i}});var e=t(1756);var i=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,e.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==t.g&&t.g.crypto?function(){return t.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},r={};function t(e){var i=r[e];if(void 0!==i)return i.exports;var o=r[e]={exports:{}};return n[e](o,o.exports,t),o.exports}t.d=function(n,r){for(var e in r)t.o(r,e)&&!t.o(n,e)&&Object.defineProperty(n,e,{enumerable:!0,get:r[e]})},t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),t.o=function(n,r){return Object.prototype.hasOwnProperty.call(n,r)},t.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"u",{value:!0})};var e={};return function(){t.r(e),t.d(e,{Hmac:function(){return r}});var n=t(4768),r=function(){function r(r,t){this.h=r,"string"==typeof t&&(t=n.d.parse(t));var e=r.blockSize,i=4*e;t.nSigBytes>i&&(t=r.finalize(t)),t.clamp();for(var o=this.v=t.clone(),u=this.l=t.clone(),f=o.words,a=u.words,s=0;s<e;s++)f[s]^=1549556828,a[s]^=909522486;u.nSigBytes=i,o.nSigBytes=i,this.reset()}return r.prototype.reset=function(){this.h.reset(),this.h.update(this.l)},r.prototype.update=function(n){return this.h.update(n),this},r.prototype.finalize=function(n){var r=this.h.finalize(n);return this.h.reset(),this.h.finalize(this.v.clone().concat(r))},r}()}(),e}()}));
\ No newline at end of file
... ...
  1 +import type { Word32Array } from "./lib/Word32Array";
  2 +export declare function HmacMD5(message: Word32Array | string, key: Word32Array | string): Word32Array;
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var i in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[i]=r[i]}}(this,(function(){return function(){"use strict";var n={6367:function(n,t,r){r.d(t,{Hmac:function(){return e}});var i=r(4768),e=function(){function n(n,t){this.t=n,"string"==typeof t&&(t=i.d.parse(t));var r=n.blockSize,e=4*r;t.nSigBytes>e&&(t=n.finalize(t)),t.clamp();for(var o=this.i=t.clone(),u=this.u=t.clone(),f=o.words,c=u.words,a=0;a<r;a++)f[a]^=1549556828,c[a]^=909522486;u.nSigBytes=e,o.nSigBytes=e,this.reset()}return n.prototype.reset=function(){this.t.reset(),this.t.update(this.u)},n.prototype.update=function(n){return this.t.update(n),this},n.prototype.finalize=function(n){var t=this.t.finalize(n);return this.t.reset(),this.t.finalize(this.i.clone().concat(t))},n}()},670:function(n,t,r){r.d(t,{MD5:function(){return v}});var i,e=r(3354),o=r(1868),u=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),f=[];function c(n,t,r,i,e,o,u){var f=n+(t&r|~t&i)+e+u;return(f<<o|f>>>32-o)+t}function a(n,t,r,i,e,o,u){var f=n+(t&i|r&~i)+e+u;return(f<<o|f>>>32-o)+t}function s(n,t,r,i,e,o,u){var f=n+(t^r^i)+e+u;return(f<<o|f>>>32-o)+t}function h(n,t,r,i,e,o,u){var f=n+(r^(t|~i))+e+u;return(f<<o|f>>>32-o)+t}!function(){for(var n=0;n<64;n++)f[n]=4294967296*Math.abs(Math.sin(n+1))|0}();var v=function(n){function t(t){var r=n.call(this,t)||this;return r.h=new e.e([1732584193,4023233417,2562383102,271733878]),t&&void 0!==t.hash&&(r.h=t.hash.clone()),r}return u(t,n),t.prototype.v=function(){this.h=new e.e([1732584193,4023233417,2562383102,271733878])},t.prototype.l=function(n,t){for(var r=0;r<16;r++){var i=t+r,e=n[i];n[i]=16711935&(e<<8|e>>>24)|4278255360&(e<<24|e>>>8)}var o=this.h.words,u=n[t],v=n[t+1],w=n[t+2],d=n[t+3],l=n[t+4],y=n[t+5],b=n[t+6],p=n[t+7],m=n[t+8],g=n[t+9],j=n[t+10],A=n[t+11],M=n[t+12],O=n[t+13],I=n[t+14],E=n[t+15],U=o[0],_=o[1],S=o[2],N=o[3];U=c(U,_,S,N,u,7,f[0]),N=c(N,U,_,S,v,12,f[1]),S=c(S,N,U,_,w,17,f[2]),_=c(_,S,N,U,d,22,f[3]),U=c(U,_,S,N,l,7,f[4]),N=c(N,U,_,S,y,12,f[5]),S=c(S,N,U,_,b,17,f[6]),_=c(_,S,N,U,p,22,f[7]),U=c(U,_,S,N,m,7,f[8]),N=c(N,U,_,S,g,12,f[9]),S=c(S,N,U,_,j,17,f[10]),_=c(_,S,N,U,A,22,f[11]),U=c(U,_,S,N,M,7,f[12]),N=c(N,U,_,S,O,12,f[13]),S=c(S,N,U,_,I,17,f[14]),U=a(U,_=c(_,S,N,U,E,22,f[15]),S,N,v,5,f[16]),N=a(N,U,_,S,b,9,f[17]),S=a(S,N,U,_,A,14,f[18]),_=a(_,S,N,U,u,20,f[19]),U=a(U,_,S,N,y,5,f[20]),N=a(N,U,_,S,j,9,f[21]),S=a(S,N,U,_,E,14,f[22]),_=a(_,S,N,U,l,20,f[23]),U=a(U,_,S,N,g,5,f[24]),N=a(N,U,_,S,I,9,f[25]),S=a(S,N,U,_,d,14,f[26]),_=a(_,S,N,U,m,20,f[27]),U=a(U,_,S,N,O,5,f[28]),N=a(N,U,_,S,w,9,f[29]),S=a(S,N,U,_,p,14,f[30]),U=s(U,_=a(_,S,N,U,M,20,f[31]),S,N,y,4,f[32]),N=s(N,U,_,S,m,11,f[33]),S=s(S,N,U,_,A,16,f[34]),_=s(_,S,N,U,I,23,f[35]),U=s(U,_,S,N,v,4,f[36]),N=s(N,U,_,S,l,11,f[37]),S=s(S,N,U,_,p,16,f[38]),_=s(_,S,N,U,j,23,f[39]),U=s(U,_,S,N,O,4,f[40]),N=s(N,U,_,S,u,11,f[41]),S=s(S,N,U,_,d,16,f[42]),_=s(_,S,N,U,b,23,f[43]),U=s(U,_,S,N,g,4,f[44]),N=s(N,U,_,S,M,11,f[45]),S=s(S,N,U,_,E,16,f[46]),U=h(U,_=s(_,S,N,U,w,23,f[47]),S,N,u,6,f[48]),N=h(N,U,_,S,p,10,f[49]),S=h(S,N,U,_,I,15,f[50]),_=h(_,S,N,U,y,21,f[51]),U=h(U,_,S,N,M,6,f[52]),N=h(N,U,_,S,d,10,f[53]),S=h(S,N,U,_,j,15,f[54]),_=h(_,S,N,U,v,21,f[55]),U=h(U,_,S,N,m,6,f[56]),N=h(N,U,_,S,E,10,f[57]),S=h(S,N,U,_,b,15,f[58]),_=h(_,S,N,U,O,21,f[59]),U=h(U,_,S,N,l,6,f[60]),N=h(N,U,_,S,A,10,f[61]),S=h(S,N,U,_,w,15,f[62]),_=h(_,S,N,U,g,21,f[63]),o[0]=o[0]+U|0,o[1]=o[1]+_|0,o[2]=o[2]+S|0,o[3]=o[3]+N|0},t.prototype.j=function(){var n=this.A,t=n.words,r=8*this.O,i=8*n.nSigBytes;t[i>>>5]|=128<<24-i%32;var e=Math.floor(r/4294967296),o=r;t[15+(i+64>>>9<<4)]=16711935&(e<<8|e>>>24)|4278255360&(e<<24|e>>>8),t[14+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n.nSigBytes=4*(t.length+1),this.I();for(var u=this.h,f=u.words,c=0;c<4;c++){var a=f[c];f[c]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return u},t.prototype.clone=function(){return new t({hash:this.h,blockSize:this.U,data:this.A,nBytes:this.O})},t.hash=function(n){return(new t).finalize(n)},t}(o.P)},3354:function(n,t,r){r.d(t,{e:function(){return o}});var i=r(5720),e=r(9054),o=function(){function n(t,r){if(Array.isArray(t)||!t)return this._=Array.isArray(t)?t:[],void(this.S="number"==typeof r?r:4*this._.length);if(t instanceof n)return this._=t.words.slice(),void(this.S=t.nSigBytes);var i;try{t instanceof ArrayBuffer?i=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!i)throw new Error("Invalid argument");for(var e=i.byteLength,o=[],u=0;u<e;u++)o[u>>>2]|=i[u]<<24-u%4*8;this._=o,this.S=e}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.S},set:function(n){this.S=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this._},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):i.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this._,t=this.S,r=new Uint8Array(t),i=0;i<t;i++)r[i]=n[i>>>2]>>>24-i%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.S%4)for(var i=0;i<r;i++){var e=t[i>>>2]>>>24-i%4*8&255;this._[this.S+i>>>2]|=e<<24-(this.S+i)%4*8}else for(i=0;i<r;i+=4)this._[this.S+i>>>2]=t[i>>>2];return this.S+=r,this},n.prototype.clamp=function(){var n=this.S;this._[n>>>2]&=4294967295<<32-n%4*8,this._.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this._.slice(),this.S)},n.random=function(t){for(var r=[],i=0;i<t;i+=4)r.push((0,e.M)());return new n(r,t)},n}()},7211:function(n,t,r){r.d(t,{C:function(){return o}});var i=r(3354),e=r(4768),o=function(){function n(n){this.N=0,this.U=0,this.F=n,this.A=n&&void 0!==n.data?n.data.clone():new i.e,this.O=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.U},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.A=void 0!==n?n.clone():new i.e,this.O="number"==typeof t?t:0},n.prototype.H=function(n){var t="string"==typeof n?e.d.parse(n):n;this.A.concat(t),this.O+=t.nSigBytes},n.prototype.I=function(n){var t,r=this.A.words,e=this.A.nSigBytes,o=this.U,u=e/(4*this.U),f=(u=n?Math.ceil(u):Math.max((0|u)-this.N,0))*o,c=Math.min(4*f,e);if(f){for(var a=0;a<f;a+=o)this.l(r,a);t=r.splice(0,f),this.A.nSigBytes-=c}return new i.e(t,c)},n.prototype.l=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,r){r.d(t,{P:function(){return u}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.U=16,r.F=t,t&&"number"==typeof t.blockSize&&(r.U=t.blockSize),r.reset(t?t.data:void 0,t?t.nBytes:void 0),r}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.U},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.v()},t.prototype.update=function(n){return this.H(n),this.I(),this},t.prototype.finalize=function(n){return n&&this.H(n),this.j()},t.prototype.v=function(){throw new Error("Not implemented")},t.prototype.j=function(){throw new Error("Not implemented")},t}(e.C)},1756:function(n,t,r){r.d(t,{w:function(){return u}});var i,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(i=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(i)?(i=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(i)&&i):i);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},5720:function(n,t,r){r.d(t,{p:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],e=0;e<t;e+=2)r[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new i.e(r,t/2)}}},8702:function(n,t,r){r.d(t,{m:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(n){for(var t=n.length,r=[],e=0;e<t;e++)r[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new i.e(r,t)}}},4768:function(n,t,r){r.d(t,{d:function(){return e}});var i=r(8702),e={stringify:function(n){try{return decodeURIComponent(escape(i.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return i.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,r){r.d(t,{M:function(){return e}});var i=r(1756);var e=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,i.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function r(i){var e=t[i];if(void 0!==e)return e.exports;var o=t[i]={exports:{}};return n[i](o,o.exports,r),o.exports}r.d=function(n,t){for(var i in t)r.o(t,i)&&!r.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"k",{value:!0})};var i={};return function(){r.r(i),r.d(i,{HmacMD5:function(){return e}});var n=r(6367),t=r(670);function e(r,i){return new n.Hmac(new t.MD5,i).finalize(r)}}(),i}()}));
\ No newline at end of file
... ...
  1 +import type { Word32Array } from "./lib/Word32Array";
  2 +export declare function HmacSHA1(message: Word32Array | string, key: Word32Array | string): Word32Array;
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var i in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[i]=r[i]}}(this,(function(){return function(){"use strict";var n={6367:function(n,t,r){r.d(t,{Hmac:function(){return e}});var i=r(4768),e=function(){function n(n,t){this.t=n,"string"==typeof t&&(t=i.d.parse(t));var r=n.blockSize,e=4*r;t.nSigBytes>e&&(t=n.finalize(t)),t.clamp();for(var o=this.i=t.clone(),u=this.u=t.clone(),f=o.words,c=u.words,s=0;s<r;s++)f[s]^=1549556828,c[s]^=909522486;u.nSigBytes=e,o.nSigBytes=e,this.reset()}return n.prototype.reset=function(){this.t.reset(),this.t.update(this.u)},n.prototype.update=function(n){return this.t.update(n),this},n.prototype.finalize=function(n){var t=this.t.finalize(n);return this.t.reset(),this.t.finalize(this.i.clone().concat(t))},n}()},3173:function(n,t,r){r.d(t,{SHA1:function(){return c}});var i,e=r(1868),o=r(3354),u=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),f=[],c=function(n){function t(t){var r=n.call(this,t)||this;return r.h=new o.e([1732584193,4023233417,2562383102,271733878,3285377520]),r.v=t,t&&void 0!==t.hash&&(r.h=t.hash.clone()),r}return u(t,n),t.prototype.l=function(){this.h=new o.e([1732584193,4023233417,2562383102,271733878,3285377520])},t.prototype.A=function(n,t){for(var r=this.h.words,i=r[0],e=r[1],o=r[2],u=r[3],c=r[4],s=0;s<80;s++){if(s<16)f[s]=0|n[t+s];else{var a=f[s-3]^f[s-8]^f[s-14]^f[s-16];f[s]=a<<1|a>>>31}var h=(i<<5|i>>>27)+c+f[s];h+=s<20?1518500249+(e&o|~e&u):s<40?1859775393+(e^o^u):s<60?(e&o|e&u|o&u)-1894007588:(e^o^u)-899497514,c=u,u=o,o=e<<30|e>>>2,e=i,i=h}r[0]=r[0]+i|0,r[1]=r[1]+e|0,r[2]=r[2]+o|0,r[3]=r[3]+u|0,r[4]=r[4]+c|0},t.prototype.j=function(){var n=this.O.words,t=8*this.I,r=8*this.O.nSigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=Math.floor(t/4294967296),n[15+(r+64>>>9<<4)]=t,this.O.nSigBytes=4*n.length,this.U(),this.h},t.prototype.clone=function(){return new t({hash:this.h,blockSize:this.S,data:this.O,nBytes:this.I})},t.hash=function(n,r){return new t(r).finalize(n)},t}(e.P)},3354:function(n,t,r){r.d(t,{e:function(){return o}});var i=r(5720),e=r(9054),o=function(){function n(t,r){if(Array.isArray(t)||!t)return this._=Array.isArray(t)?t:[],void(this.N="number"==typeof r?r:4*this._.length);if(t instanceof n)return this._=t.words.slice(),void(this.N=t.nSigBytes);var i;try{t instanceof ArrayBuffer?i=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!i)throw new Error("Invalid argument");for(var e=i.byteLength,o=[],u=0;u<e;u++)o[u>>>2]|=i[u]<<24-u%4*8;this._=o,this.N=e}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.N},set:function(n){this.N=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this._},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):i.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this._,t=this.N,r=new Uint8Array(t),i=0;i<t;i++)r[i]=n[i>>>2]>>>24-i%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.N%4)for(var i=0;i<r;i++){var e=t[i>>>2]>>>24-i%4*8&255;this._[this.N+i>>>2]|=e<<24-(this.N+i)%4*8}else for(i=0;i<r;i+=4)this._[this.N+i>>>2]=t[i>>>2];return this.N+=r,this},n.prototype.clamp=function(){var n=this.N;this._[n>>>2]&=4294967295<<32-n%4*8,this._.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this._.slice(),this.N)},n.random=function(t){for(var r=[],i=0;i<t;i+=4)r.push((0,e.M)());return new n(r,t)},n}()},7211:function(n,t,r){r.d(t,{C:function(){return o}});var i=r(3354),e=r(4768),o=function(){function n(n){this.H=0,this.S=0,this.v=n,this.O=n&&void 0!==n.data?n.data.clone():new i.e,this.I=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.S},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.O=void 0!==n?n.clone():new i.e,this.I="number"==typeof t?t:0},n.prototype.F=function(n){var t="string"==typeof n?e.d.parse(n):n;this.O.concat(t),this.I+=t.nSigBytes},n.prototype.U=function(n){var t,r=this.O.words,e=this.O.nSigBytes,o=this.S,u=e/(4*this.S),f=(u=n?Math.ceil(u):Math.max((0|u)-this.H,0))*o,c=Math.min(4*f,e);if(f){for(var s=0;s<f;s+=o)this.A(r,s);t=r.splice(0,f),this.O.nSigBytes-=c}return new i.e(t,c)},n.prototype.A=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,r){r.d(t,{P:function(){return u}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.S=16,r.v=t,t&&"number"==typeof t.blockSize&&(r.S=t.blockSize),r.reset(t?t.data:void 0,t?t.nBytes:void 0),r}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.S},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.l()},t.prototype.update=function(n){return this.F(n),this.U(),this},t.prototype.finalize=function(n){return n&&this.F(n),this.j()},t.prototype.l=function(){throw new Error("Not implemented")},t.prototype.j=function(){throw new Error("Not implemented")},t}(e.C)},1756:function(n,t,r){r.d(t,{w:function(){return u}});var i,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(i=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(i)?(i=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(i)&&i):i);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},5720:function(n,t,r){r.d(t,{p:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],e=0;e<t;e+=2)r[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new i.e(r,t/2)}}},8702:function(n,t,r){r.d(t,{m:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(n){for(var t=n.length,r=[],e=0;e<t;e++)r[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new i.e(r,t)}}},4768:function(n,t,r){r.d(t,{d:function(){return e}});var i=r(8702),e={stringify:function(n){try{return decodeURIComponent(escape(i.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return i.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,r){r.d(t,{M:function(){return e}});var i=r(1756);var e=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,i.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function r(i){var e=t[i];if(void 0!==e)return e.exports;var o=t[i]={exports:{}};return n[i](o,o.exports,r),o.exports}r.d=function(n,t){for(var i in t)r.o(t,i)&&!r.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"k",{value:!0})};var i={};return function(){r.r(i),r.d(i,{HmacSHA1:function(){return e}});var n=r(6367),t=r(3173);function e(r,i){return new n.Hmac(new t.SHA1,i).finalize(r)}}(),i}()}));
\ No newline at end of file
... ...
  1 +import type { Word32Array } from "./lib/Word32Array";
  2 +export declare function HmacSHA224(message: Word32Array | string, key: Word32Array | string): Word32Array;
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var i in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[i]=r[i]}}(this,(function(){return function(){"use strict";var n={6367:function(n,t,r){r.d(t,{Hmac:function(){return e}});var i=r(4768),e=function(){function n(n,t){this.t=n,"string"==typeof t&&(t=i.d.parse(t));var r=n.blockSize,e=4*r;t.nSigBytes>e&&(t=n.finalize(t)),t.clamp();for(var o=this.i=t.clone(),u=this.u=t.clone(),f=o.words,c=u.words,s=0;s<r;s++)f[s]^=1549556828,c[s]^=909522486;u.nSigBytes=e,o.nSigBytes=e,this.reset()}return n.prototype.reset=function(){this.t.reset(),this.t.update(this.u)},n.prototype.update=function(n){return this.t.update(n),this},n.prototype.finalize=function(n){var t=this.t.finalize(n);return this.t.reset(),this.t.finalize(this.i.clone().concat(t))},n}()},766:function(n,t,r){r.d(t,{SHA224:function(){return f}});var i,e=r(3354),o=r(5561),u=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),f=function(n){function t(t){var r=n.call(this,t)||this;return r.h=new e.e([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),r.v=t,t&&void 0!==t.hash&&(r.h=t.hash.clone()),r}return u(t,n),t.prototype.l=function(){this.h=new e.e([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},t.prototype.A=function(){var t=n.prototype.A.call(this);return t.nSigBytes-=4,t},t.prototype.clone=function(){return new t({hash:this.h,blockSize:this.j,data:this.O,nBytes:this._})},t.hash=function(n,r){return new t(r).finalize(n)},t}(o.SHA256)},5561:function(n,t,r){r.d(t,{SHA256:function(){return v}});var i,e=r(1868),o=r(3354),u=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),f=[],c=[];function s(n){for(var t=Math.sqrt(n),r=2;r<=t;r++)if(!(n%r))return!1;return!0}function a(n){return 4294967296*(n-(0|n))|0}!function(){for(var n=2,t=0;t<64;)s(n)&&(t<8&&(f[t]=a(Math.pow(n,.5))),c[t]=a(Math.pow(n,1/3)),t++),n++}();var h=[],v=function(n){function t(t){var r=n.call(this,t)||this;return r.h=new o.e(f.slice(0)),r.v=t,t&&void 0!==t.hash&&(r.h=t.hash.clone()),r}return u(t,n),t.prototype.l=function(){this.h=new o.e(f.slice(0))},t.prototype.I=function(n,t){for(var r=this.h.words,i=r[0],e=r[1],o=r[2],u=r[3],f=r[4],s=r[5],a=r[6],v=r[7],w=0;w<64;w++){if(w<16)h[w]=0|n[t+w];else{var d=h[w-15],l=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,y=h[w-2],b=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;h[w]=l+h[w-7]+b+h[w-16]}var p=i&e^i&o^e&o,m=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),g=v+((f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25))+(f&s^~f&a)+c[w]+h[w];v=a,a=s,s=f,f=u+g|0,u=o,o=e,e=i,i=g+(m+p)|0}r[0]=r[0]+i|0,r[1]=r[1]+e|0,r[2]=r[2]+o|0,r[3]=r[3]+u|0,r[4]=r[4]+f|0,r[5]=r[5]+s|0,r[6]=r[6]+a|0,r[7]=r[7]+v|0},t.prototype.A=function(){var n=this.O.words,t=8*this._,r=8*this.O.nSigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=Math.floor(t/4294967296),n[15+(r+64>>>9<<4)]=t,this.O.nSigBytes=4*n.length,this.S(),this.h},t.prototype.clone=function(){return new t({hash:this.h,blockSize:this.j,data:this.O,nBytes:this._})},t.hash=function(n,r){return new t(r).finalize(n)},t}(e.P)},3354:function(n,t,r){r.d(t,{e:function(){return o}});var i=r(5720),e=r(9054),o=function(){function n(t,r){if(Array.isArray(t)||!t)return this.U=Array.isArray(t)?t:[],void(this.H="number"==typeof r?r:4*this.U.length);if(t instanceof n)return this.U=t.words.slice(),void(this.H=t.nSigBytes);var i;try{t instanceof ArrayBuffer?i=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!i)throw new Error("Invalid argument");for(var e=i.byteLength,o=[],u=0;u<e;u++)o[u>>>2]|=i[u]<<24-u%4*8;this.U=o,this.H=e}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.H},set:function(n){this.H=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.U},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):i.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.U,t=this.H,r=new Uint8Array(t),i=0;i<t;i++)r[i]=n[i>>>2]>>>24-i%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.H%4)for(var i=0;i<r;i++){var e=t[i>>>2]>>>24-i%4*8&255;this.U[this.H+i>>>2]|=e<<24-(this.H+i)%4*8}else for(i=0;i<r;i+=4)this.U[this.H+i>>>2]=t[i>>>2];return this.H+=r,this},n.prototype.clamp=function(){var n=this.H;this.U[n>>>2]&=4294967295<<32-n%4*8,this.U.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.U.slice(),this.H)},n.random=function(t){for(var r=[],i=0;i<t;i+=4)r.push((0,e.M)());return new n(r,t)},n}()},7211:function(n,t,r){r.d(t,{C:function(){return o}});var i=r(3354),e=r(4768),o=function(){function n(n){this.N=0,this.j=0,this.v=n,this.O=n&&void 0!==n.data?n.data.clone():new i.e,this._=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.j},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.O=void 0!==n?n.clone():new i.e,this._="number"==typeof t?t:0},n.prototype.F=function(n){var t="string"==typeof n?e.d.parse(n):n;this.O.concat(t),this._+=t.nSigBytes},n.prototype.S=function(n){var t,r=this.O.words,e=this.O.nSigBytes,o=this.j,u=e/(4*this.j),f=(u=n?Math.ceil(u):Math.max((0|u)-this.N,0))*o,c=Math.min(4*f,e);if(f){for(var s=0;s<f;s+=o)this.I(r,s);t=r.splice(0,f),this.O.nSigBytes-=c}return new i.e(t,c)},n.prototype.I=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,r){r.d(t,{P:function(){return u}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.j=16,r.v=t,t&&"number"==typeof t.blockSize&&(r.j=t.blockSize),r.reset(t?t.data:void 0,t?t.nBytes:void 0),r}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.j},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.l()},t.prototype.update=function(n){return this.F(n),this.S(),this},t.prototype.finalize=function(n){return n&&this.F(n),this.A()},t.prototype.l=function(){throw new Error("Not implemented")},t.prototype.A=function(){throw new Error("Not implemented")},t}(e.C)},1756:function(n,t,r){r.d(t,{w:function(){return u}});var i,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(i=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(i)?(i=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(i)&&i):i);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},5720:function(n,t,r){r.d(t,{p:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],e=0;e<t;e+=2)r[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new i.e(r,t/2)}}},8702:function(n,t,r){r.d(t,{m:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(n){for(var t=n.length,r=[],e=0;e<t;e++)r[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new i.e(r,t)}}},4768:function(n,t,r){r.d(t,{d:function(){return e}});var i=r(8702),e={stringify:function(n){try{return decodeURIComponent(escape(i.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return i.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,r){r.d(t,{M:function(){return e}});var i=r(1756);var e=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,i.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function r(i){var e=t[i];if(void 0!==e)return e.exports;var o=t[i]={exports:{}};return n[i](o,o.exports,r),o.exports}r.d=function(n,t){for(var i in t)r.o(t,i)&&!r.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"k",{value:!0})};var i={};return function(){r.r(i),r.d(i,{HmacSHA224:function(){return e}});var n=r(6367),t=r(766);function e(r,i){return new n.Hmac(new t.SHA224,i).finalize(r)}}(),i}()}));
\ No newline at end of file
... ...
  1 +import type { Word32Array } from "./lib/Word32Array";
  2 +export declare function HmacSHA256(message: Word32Array | string, key: Word32Array | string): Word32Array;
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var i in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[i]=r[i]}}(this,(function(){return function(){"use strict";var n={6367:function(n,t,r){r.d(t,{Hmac:function(){return e}});var i=r(4768),e=function(){function n(n,t){this.t=n,"string"==typeof t&&(t=i.d.parse(t));var r=n.blockSize,e=4*r;t.nSigBytes>e&&(t=n.finalize(t)),t.clamp();for(var o=this.i=t.clone(),u=this.u=t.clone(),f=o.words,c=u.words,a=0;a<r;a++)f[a]^=1549556828,c[a]^=909522486;u.nSigBytes=e,o.nSigBytes=e,this.reset()}return n.prototype.reset=function(){this.t.reset(),this.t.update(this.u)},n.prototype.update=function(n){return this.t.update(n),this},n.prototype.finalize=function(n){var t=this.t.finalize(n);return this.t.reset(),this.t.finalize(this.i.clone().concat(t))},n}()},5561:function(n,t,r){r.d(t,{SHA256:function(){return v}});var i,e=r(1868),o=r(3354),u=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),f=[],c=[];function a(n){for(var t=Math.sqrt(n),r=2;r<=t;r++)if(!(n%r))return!1;return!0}function s(n){return 4294967296*(n-(0|n))|0}!function(){for(var n=2,t=0;t<64;)a(n)&&(t<8&&(f[t]=s(Math.pow(n,.5))),c[t]=s(Math.pow(n,1/3)),t++),n++}();var h=[],v=function(n){function t(t){var r=n.call(this,t)||this;return r.h=new o.e(f.slice(0)),r.v=t,t&&void 0!==t.hash&&(r.h=t.hash.clone()),r}return u(t,n),t.prototype.l=function(){this.h=new o.e(f.slice(0))},t.prototype.A=function(n,t){for(var r=this.h.words,i=r[0],e=r[1],o=r[2],u=r[3],f=r[4],a=r[5],s=r[6],v=r[7],w=0;w<64;w++){if(w<16)h[w]=0|n[t+w];else{var d=h[w-15],l=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,y=h[w-2],b=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;h[w]=l+h[w-7]+b+h[w-16]}var p=i&e^i&o^e&o,m=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),g=v+((f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25))+(f&a^~f&s)+c[w]+h[w];v=s,s=a,a=f,f=u+g|0,u=o,o=e,e=i,i=g+(m+p)|0}r[0]=r[0]+i|0,r[1]=r[1]+e|0,r[2]=r[2]+o|0,r[3]=r[3]+u|0,r[4]=r[4]+f|0,r[5]=r[5]+a|0,r[6]=r[6]+s|0,r[7]=r[7]+v|0},t.prototype.j=function(){var n=this.O.words,t=8*this.I,r=8*this.O.nSigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=Math.floor(t/4294967296),n[15+(r+64>>>9<<4)]=t,this.O.nSigBytes=4*n.length,this.U(),this.h},t.prototype.clone=function(){return new t({hash:this.h,blockSize:this.S,data:this.O,nBytes:this.I})},t.hash=function(n,r){return new t(r).finalize(n)},t}(e.P)},3354:function(n,t,r){r.d(t,{e:function(){return o}});var i=r(5720),e=r(9054),o=function(){function n(t,r){if(Array.isArray(t)||!t)return this._=Array.isArray(t)?t:[],void(this.N="number"==typeof r?r:4*this._.length);if(t instanceof n)return this._=t.words.slice(),void(this.N=t.nSigBytes);var i;try{t instanceof ArrayBuffer?i=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!i)throw new Error("Invalid argument");for(var e=i.byteLength,o=[],u=0;u<e;u++)o[u>>>2]|=i[u]<<24-u%4*8;this._=o,this.N=e}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.N},set:function(n){this.N=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this._},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):i.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this._,t=this.N,r=new Uint8Array(t),i=0;i<t;i++)r[i]=n[i>>>2]>>>24-i%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.N%4)for(var i=0;i<r;i++){var e=t[i>>>2]>>>24-i%4*8&255;this._[this.N+i>>>2]|=e<<24-(this.N+i)%4*8}else for(i=0;i<r;i+=4)this._[this.N+i>>>2]=t[i>>>2];return this.N+=r,this},n.prototype.clamp=function(){var n=this.N;this._[n>>>2]&=4294967295<<32-n%4*8,this._.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this._.slice(),this.N)},n.random=function(t){for(var r=[],i=0;i<t;i+=4)r.push((0,e.M)());return new n(r,t)},n}()},7211:function(n,t,r){r.d(t,{C:function(){return o}});var i=r(3354),e=r(4768),o=function(){function n(n){this.H=0,this.S=0,this.v=n,this.O=n&&void 0!==n.data?n.data.clone():new i.e,this.I=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.S},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.O=void 0!==n?n.clone():new i.e,this.I="number"==typeof t?t:0},n.prototype.F=function(n){var t="string"==typeof n?e.d.parse(n):n;this.O.concat(t),this.I+=t.nSigBytes},n.prototype.U=function(n){var t,r=this.O.words,e=this.O.nSigBytes,o=this.S,u=e/(4*this.S),f=(u=n?Math.ceil(u):Math.max((0|u)-this.H,0))*o,c=Math.min(4*f,e);if(f){for(var a=0;a<f;a+=o)this.A(r,a);t=r.splice(0,f),this.O.nSigBytes-=c}return new i.e(t,c)},n.prototype.A=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,r){r.d(t,{P:function(){return u}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.S=16,r.v=t,t&&"number"==typeof t.blockSize&&(r.S=t.blockSize),r.reset(t?t.data:void 0,t?t.nBytes:void 0),r}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.S},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.l()},t.prototype.update=function(n){return this.F(n),this.U(),this},t.prototype.finalize=function(n){return n&&this.F(n),this.j()},t.prototype.l=function(){throw new Error("Not implemented")},t.prototype.j=function(){throw new Error("Not implemented")},t}(e.C)},1756:function(n,t,r){r.d(t,{w:function(){return u}});var i,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(i=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(i)?(i=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(i)&&i):i);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},5720:function(n,t,r){r.d(t,{p:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],e=0;e<t;e+=2)r[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new i.e(r,t/2)}}},8702:function(n,t,r){r.d(t,{m:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(n){for(var t=n.length,r=[],e=0;e<t;e++)r[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new i.e(r,t)}}},4768:function(n,t,r){r.d(t,{d:function(){return e}});var i=r(8702),e={stringify:function(n){try{return decodeURIComponent(escape(i.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return i.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,r){r.d(t,{M:function(){return e}});var i=r(1756);var e=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,i.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function r(i){var e=t[i];if(void 0!==e)return e.exports;var o=t[i]={exports:{}};return n[i](o,o.exports,r),o.exports}r.d=function(n,t){for(var i in t)r.o(t,i)&&!r.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"k",{value:!0})};var i={};return function(){r.r(i),r.d(i,{HmacSHA256:function(){return e}});var n=r(6367),t=r(5561);function e(r,i){return new n.Hmac(new t.SHA256,i).finalize(r)}}(),i}()}));
\ No newline at end of file
... ...
  1 +import type { Word32Array } from "./lib/Word32Array";
  2 +export declare function HmacSHA384(message: Word32Array | string, key: Word32Array | string): Word32Array;
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var e=t();for(var r in n.JsCrypto=n.JsCrypto||{},e)n.JsCrypto[r]=e[r]}}(this,(function(){return function(){"use strict";var n={6367:function(n,t,e){e.d(t,{Hmac:function(){return i}});var r=e(4768),i=function(){function n(n,t){this.t=n,"string"==typeof t&&(t=r.d.parse(t));var e=n.blockSize,i=4*e;t.nSigBytes>i&&(t=n.finalize(t)),t.clamp();for(var o=this.i=t.clone(),u=this.u=t.clone(),f=o.words,c=u.words,s=0;s<e;s++)f[s]^=1549556828,c[s]^=909522486;u.nSigBytes=i,o.nSigBytes=i,this.reset()}return n.prototype.reset=function(){this.t.reset(),this.t.update(this.u)},n.prototype.update=function(n){return this.t.update(n),this},n.prototype.finalize=function(n){var t=this.t.finalize(n);return this.t.reset(),this.t.finalize(this.i.clone().concat(t))},n}()},6324:function(n,t,e){e.d(t,{SHA384:function(){return f}});var r,i=e(6957),o=e(7491),u=(r=function(n,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])})(n,t)},function(n,t){function e(){this.constructor=n}r(n,t),n.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),f=function(n){function t(t){var e=n.call(this,t)||this;return e.h=new i.m([new i.r(3418070365,3238371032),new i.r(1654270250,914150663),new i.r(2438529370,812702999),new i.r(355462360,4144912697),new i.r(1731405415,4290775857),new i.r(2394180231,1750603025),new i.r(3675008525,1694076839),new i.r(1203062813,3204075428)]),e.v=t,t&&void 0!==t.hash&&(e.h=t.hash.clone()),e}return u(t,n),t.prototype.l=function(){this.h=new i.m([new i.r(3418070365,3238371032),new i.r(1654270250,914150663),new i.r(2438529370,812702999),new i.r(355462360,4144912697),new i.r(1731405415,4290775857),new i.r(2394180231,1750603025),new i.r(3675008525,1694076839),new i.r(1203062813,3204075428)])},t.prototype.j=function(){var t=n.prototype.j.call(this);return t.nSigBytes-=16,t},t.prototype.clone=function(){return new t({hash:this.h,blockSize:this.A,data:this.O,nBytes:this._})},t.hash=function(n,e){return new t(e).finalize(n)},t}(o.SHA512)},7491:function(n,t,e){e.d(t,{SHA512:function(){return s}});var r,i=e(1868),o=e(6957),u=(r=function(n,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])})(n,t)},function(n,t){function e(){this.constructor=n}r(n,t),n.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),f=[new o.r(1116352408,3609767458),new o.r(1899447441,602891725),new o.r(3049323471,3964484399),new o.r(3921009573,2173295548),new o.r(961987163,4081628472),new o.r(1508970993,3053834265),new o.r(2453635748,2937671579),new o.r(2870763221,3664609560),new o.r(3624381080,2734883394),new o.r(310598401,1164996542),new o.r(607225278,1323610764),new o.r(1426881987,3590304994),new o.r(1925078388,4068182383),new o.r(2162078206,991336113),new o.r(2614888103,633803317),new o.r(3248222580,3479774868),new o.r(3835390401,2666613458),new o.r(4022224774,944711139),new o.r(264347078,2341262773),new o.r(604807628,2007800933),new o.r(770255983,1495990901),new o.r(1249150122,1856431235),new o.r(1555081692,3175218132),new o.r(1996064986,2198950837),new o.r(2554220882,3999719339),new o.r(2821834349,766784016),new o.r(2952996808,2566594879),new o.r(3210313671,3203337956),new o.r(3336571891,1034457026),new o.r(3584528711,2466948901),new o.r(113926993,3758326383),new o.r(338241895,168717936),new o.r(666307205,1188179964),new o.r(773529912,1546045734),new o.r(1294757372,1522805485),new o.r(1396182291,2643833823),new o.r(1695183700,2343527390),new o.r(1986661051,1014477480),new o.r(2177026350,1206759142),new o.r(2456956037,344077627),new o.r(2730485921,1290863460),new o.r(2820302411,3158454273),new o.r(3259730800,3505952657),new o.r(3345764771,106217008),new o.r(3516065817,3606008344),new o.r(3600352804,1432725776),new o.r(4094571909,1467031594),new o.r(275423344,851169720),new o.r(430227734,3100823752),new o.r(506948616,1363258195),new o.r(659060556,3750685593),new o.r(883997877,3785050280),new o.r(958139571,3318307427),new o.r(1322822218,3812723403),new o.r(1537002063,2003034995),new o.r(1747873779,3602036899),new o.r(1955562222,1575990012),new o.r(2024104815,1125592928),new o.r(2227730452,2716904306),new o.r(2361852424,442776044),new o.r(2428436474,593698344),new o.r(2756734187,3733110249),new o.r(3204031479,2999351573),new o.r(3329325298,3815920427),new o.r(3391569614,3928383900),new o.r(3515267271,566280711),new o.r(3940187606,3454069534),new o.r(4118630271,4000239992),new o.r(116418474,1914138554),new o.r(174292421,2731055270),new o.r(289380356,3203993006),new o.r(460393269,320620315),new o.r(685471733,587496836),new o.r(852142971,1086792851),new o.r(1017036298,365543100),new o.r(1126000580,2618297676),new o.r(1288033470,3409855158),new o.r(1501505948,4234509866),new o.r(1607167915,987167468),new o.r(1816402316,1246189591)],c=[];!function(){for(var n=0;n<80;n++)c[n]=new o.r(0,0)}();var s=function(n){function t(t){var e=n.call(this,t)||this;return e.A=32,e.h=new o.m([new o.r(1779033703,4089235720),new o.r(3144134277,2227873595),new o.r(1013904242,4271175723),new o.r(2773480762,1595750129),new o.r(1359893119,2917565137),new o.r(2600822924,725511199),new o.r(528734635,4215389547),new o.r(1541459225,327033209)]),e.v=t,t&&void 0!==t.hash&&(e.h=t.hash.clone()),e}return u(t,n),t.prototype.l=function(){this.h=new o.m([new o.r(1779033703,4089235720),new o.r(3144134277,2227873595),new o.r(1013904242,4271175723),new o.r(2773480762,1595750129),new o.r(1359893119,2917565137),new o.r(2600822924,725511199),new o.r(528734635,4215389547),new o.r(1541459225,327033209)])},t.prototype.I=function(n,t){for(var e=this.h.words,r=e[0],i=e[1],o=e[2],u=e[3],s=e[4],w=e[5],a=e[6],h=e[7],v=r.high,d=r.low,l=i.high,b=i.low,y=o.high,p=o.low,m=u.high,g=u.low,j=s.high,A=s.low,O=w.high,_=w.low,I=a.high,S=a.low,E=h.high,M=h.low,U=v,H=d,N=l,x=b,B=y,C=p,F=m,k=g,z=j,T=A,P=O,R=_,q=I,$=S,D=E,G=M,J=0;J<80;J++){var K=void 0,L=void 0,Q=c[J];if(J<16)L=Q.high=0|n[t+2*J],K=Q.low=0|n[t+2*J+1];else{var V=c[J-15],W=V.high,X=V.low,Y=(W>>>1|X<<31)^(W>>>8|X<<24)^W>>>7,Z=(X>>>1|W<<31)^(X>>>8|W<<24)^(X>>>7|W<<25),nn=c[J-2],tn=nn.high,en=nn.low,rn=(tn>>>19|en<<13)^(tn<<3|en>>>29)^tn>>>6,on=(en>>>19|tn<<13)^(en<<3|tn>>>29)^(en>>>6|tn<<26),un=c[J-7],fn=un.high,cn=un.low,sn=c[J-16],wn=sn.high,an=sn.low;L=(L=(L=Y+fn+((K=Z+cn)>>>0<Z>>>0?1:0))+rn+((K+=on)>>>0<on>>>0?1:0))+wn+((K+=an)>>>0<an>>>0?1:0),Q.high=L,Q.low=K}var hn=z&P^~z&q,vn=T&R^~T&$,dn=U&N^U&B^N&B,ln=H&x^H&C^x&C,bn=(U>>>28|H<<4)^(U<<30|H>>>2)^(U<<25|H>>>7),yn=(H>>>28|U<<4)^(H<<30|U>>>2)^(H<<25|U>>>7),pn=(z>>>14|T<<18)^(z>>>18|T<<14)^(z<<23|T>>>9),mn=(T>>>14|z<<18)^(T>>>18|z<<14)^(T<<23|z>>>9),gn=f[J],jn=gn.high,An=gn.low,On=G+mn,_n=D+pn+(On>>>0<G>>>0?1:0),In=yn+ln;D=q,G=$,q=P,$=R,P=z,R=T,z=F+(_n=(_n=(_n=_n+hn+((On+=vn)>>>0<vn>>>0?1:0))+jn+((On+=An)>>>0<An>>>0?1:0))+L+((On+=K)>>>0<K>>>0?1:0))+((T=k+On|0)>>>0<k>>>0?1:0)|0,F=B,k=C,B=N,C=x,N=U,x=H,U=_n+(bn+dn+(In>>>0<yn>>>0?1:0))+((H=On+In|0)>>>0<On>>>0?1:0)|0}d=r.low=d+H,r.high=v+U+(d>>>0<H>>>0?1:0),b=i.low=b+x,i.high=l+N+(b>>>0<x>>>0?1:0),p=o.low=p+C,o.high=y+B+(p>>>0<C>>>0?1:0),g=u.low=g+k,u.high=m+F+(g>>>0<k>>>0?1:0),A=s.low=A+T,s.high=j+z+(A>>>0<T>>>0?1:0),_=w.low=_+R,w.high=O+P+(_>>>0<R>>>0?1:0),S=a.low=S+$,a.high=I+q+(S>>>0<$>>>0?1:0),M=h.low=M+G,h.high=E+D+(M>>>0<G>>>0?1:0)},t.prototype.j=function(){var n=this.O,t=n.words,e=8*this._,r=8*n.nSigBytes;return t[r>>>5]|=128<<24-r%32,t[30+(r+128>>>10<<5)]=Math.floor(e/4294967296),t[31+(r+128>>>10<<5)]=e,n.nSigBytes=4*t.length,this.S(),this.h.to32()},t.prototype.clone=function(){return new t({hash:this.h,blockSize:this.A,data:this.O,nBytes:this._})},t.hash=function(n,e){return new t(e).finalize(n)},t}(i.P)},3354:function(n,t,e){e.d(t,{e:function(){return o}});var r=e(5720),i=e(9054),o=function(){function n(t,e){if(Array.isArray(t)||!t)return this.U=Array.isArray(t)?t:[],void(this.H="number"==typeof e?e:4*this.U.length);if(t instanceof n)return this.U=t.words.slice(),void(this.H=t.nSigBytes);var r;try{t instanceof ArrayBuffer?r=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!r)throw new Error("Invalid argument");for(var i=r.byteLength,o=[],u=0;u<i;u++)o[u>>>2]|=r[u]<<24-u%4*8;this.U=o,this.H=i}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.H},set:function(n){this.H=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.U},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):r.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.U,t=this.H,e=new Uint8Array(t),r=0;r<t;r++)e[r]=n[r>>>2]>>>24-r%4*8&255;return e},n.prototype.concat=function(n){var t=n.words.slice(),e=n.nSigBytes;if(this.clamp(),this.H%4)for(var r=0;r<e;r++){var i=t[r>>>2]>>>24-r%4*8&255;this.U[this.H+r>>>2]|=i<<24-(this.H+r)%4*8}else for(r=0;r<e;r+=4)this.U[this.H+r>>>2]=t[r>>>2];return this.H+=e,this},n.prototype.clamp=function(){var n=this.H;this.U[n>>>2]&=4294967295<<32-n%4*8,this.U.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.U.slice(),this.H)},n.random=function(t){for(var e=[],r=0;r<t;r+=4)e.push((0,i.M)());return new n(e,t)},n}()},6957:function(n,t,e){e.d(t,{r:function(){return o},m:function(){return u}});var r=e(5720),i=e(3354),o=function(){function n(n,t){this.high=n,this.low=t}return n.prototype.clone=function(){return new n(this.high,this.low)},n}(),u=function(){function n(n,t){this.U=n||[],this.H="number"==typeof t?t:8*this.U.length}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.H},set:function(n){this.H=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.U},enumerable:!1,configurable:!0}),n.prototype.to32=function(){for(var n=[],t=0;t<this.U.length;t++){var e=this.U[t];n.push(e.high),n.push(e.low)}return new i.e(n,this.H)},n.prototype.toString=function(n){return n?n.stringify(this.to32()):r.p.stringify(this.to32())},n.prototype.clone=function(){for(var t=this.U.slice(),e=0;e<t.length;e++)t[e]=t[e].clone();return new n(t,this.H)},n}()},7211:function(n,t,e){e.d(t,{C:function(){return o}});var r=e(3354),i=e(4768),o=function(){function n(n){this.N=0,this.A=0,this.v=n,this.O=n&&void 0!==n.data?n.data.clone():new r.e,this._=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.A},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.O=void 0!==n?n.clone():new r.e,this._="number"==typeof t?t:0},n.prototype.B=function(n){var t="string"==typeof n?i.d.parse(n):n;this.O.concat(t),this._+=t.nSigBytes},n.prototype.S=function(n){var t,e=this.O.words,i=this.O.nSigBytes,o=this.A,u=i/(4*this.A),f=(u=n?Math.ceil(u):Math.max((0|u)-this.N,0))*o,c=Math.min(4*f,i);if(f){for(var s=0;s<f;s+=o)this.I(e,s);t=e.splice(0,f),this.O.nSigBytes-=c}return new r.e(t,c)},n.prototype.I=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,e){e.d(t,{P:function(){return u}});var r,i=e(7211),o=(r=function(n,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])})(n,t)},function(n,t){function e(){this.constructor=n}r(n,t),n.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),u=function(n){function t(t){var e=n.call(this,t)||this;return e.A=16,e.v=t,t&&"number"==typeof t.blockSize&&(e.A=t.blockSize),e.reset(t?t.data:void 0,t?t.nBytes:void 0),e}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.A},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,e){n.prototype.reset.call(this,t,e),this.l()},t.prototype.update=function(n){return this.B(n),this.S(),this},t.prototype.finalize=function(n){return n&&this.B(n),this.j()},t.prototype.l=function(){throw new Error("Not implemented")},t.prototype.j=function(){throw new Error("Not implemented")},t}(i.C)},1756:function(n,t,e){e.d(t,{w:function(){return u}});var r,i="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(r=parseInt((/msie (\d+)/.exec(i)||[])[1],10),isNaN(r)?(r=parseInt((/trident\/.*; rv:(\d+)/.exec(i)||[])[1],10),!isNaN(r)&&r):r);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},5720:function(n,t,e){e.d(t,{p:function(){return i}});var r=e(3354),i={stringify:function(n){for(var t=n.nSigBytes,e=n.words,r=[],i=0;i<t;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var e=[],i=0;i<t;i+=2)e[i>>>3]|=parseInt(n.substr(i,2),16)<<24-i%8*4;return new r.e(e,t/2)}}},8702:function(n,t,e){e.d(t,{m:function(){return i}});var r=e(3354),i={stringify:function(n){for(var t=n.nSigBytes,e=n.words,r=[],i=0;i<t;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(n){for(var t=n.length,e=[],i=0;i<t;i++)e[i>>>2]|=(255&n.charCodeAt(i))<<24-i%4*8;return new r.e(e,t)}}},4768:function(n,t,e){e.d(t,{d:function(){return i}});var r=e(8702),i={stringify:function(n){try{return decodeURIComponent(escape(r.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return r.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,e){e.d(t,{M:function(){return i}});var r=e(1756);var i=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,r.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==e.g&&e.g.crypto?function(){return e.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function e(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return n[r](o,o.exports,e),o.exports}e.d=function(n,t){for(var r in t)e.o(t,r)&&!e.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:t[r]})},e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),e.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},e.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"F",{value:!0})};var r={};return function(){e.r(r),e.d(r,{HmacSHA384:function(){return i}});var n=e(6367),t=e(6324);function i(e,r){return new n.Hmac(new t.SHA384,r).finalize(e)}}(),r}()}));
\ No newline at end of file
... ...
  1 +import type { Word32Array } from "./lib/Word32Array";
  2 +export declare function HmacSHA512(message: Word32Array | string, key: Word32Array | string): Word32Array;
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var e=t();for(var r in n.JsCrypto=n.JsCrypto||{},e)n.JsCrypto[r]=e[r]}}(this,(function(){return function(){"use strict";var n={6367:function(n,t,e){e.d(t,{Hmac:function(){return i}});var r=e(4768),i=function(){function n(n,t){this.t=n,"string"==typeof t&&(t=r.d.parse(t));var e=n.blockSize,i=4*e;t.nSigBytes>i&&(t=n.finalize(t)),t.clamp();for(var o=this.i=t.clone(),u=this.u=t.clone(),f=o.words,c=u.words,s=0;s<e;s++)f[s]^=1549556828,c[s]^=909522486;u.nSigBytes=i,o.nSigBytes=i,this.reset()}return n.prototype.reset=function(){this.t.reset(),this.t.update(this.u)},n.prototype.update=function(n){return this.t.update(n),this},n.prototype.finalize=function(n){var t=this.t.finalize(n);return this.t.reset(),this.t.finalize(this.i.clone().concat(t))},n}()},7491:function(n,t,e){e.d(t,{SHA512:function(){return s}});var r,i=e(1868),o=e(6957),u=(r=function(n,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])})(n,t)},function(n,t){function e(){this.constructor=n}r(n,t),n.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),f=[new o.r(1116352408,3609767458),new o.r(1899447441,602891725),new o.r(3049323471,3964484399),new o.r(3921009573,2173295548),new o.r(961987163,4081628472),new o.r(1508970993,3053834265),new o.r(2453635748,2937671579),new o.r(2870763221,3664609560),new o.r(3624381080,2734883394),new o.r(310598401,1164996542),new o.r(607225278,1323610764),new o.r(1426881987,3590304994),new o.r(1925078388,4068182383),new o.r(2162078206,991336113),new o.r(2614888103,633803317),new o.r(3248222580,3479774868),new o.r(3835390401,2666613458),new o.r(4022224774,944711139),new o.r(264347078,2341262773),new o.r(604807628,2007800933),new o.r(770255983,1495990901),new o.r(1249150122,1856431235),new o.r(1555081692,3175218132),new o.r(1996064986,2198950837),new o.r(2554220882,3999719339),new o.r(2821834349,766784016),new o.r(2952996808,2566594879),new o.r(3210313671,3203337956),new o.r(3336571891,1034457026),new o.r(3584528711,2466948901),new o.r(113926993,3758326383),new o.r(338241895,168717936),new o.r(666307205,1188179964),new o.r(773529912,1546045734),new o.r(1294757372,1522805485),new o.r(1396182291,2643833823),new o.r(1695183700,2343527390),new o.r(1986661051,1014477480),new o.r(2177026350,1206759142),new o.r(2456956037,344077627),new o.r(2730485921,1290863460),new o.r(2820302411,3158454273),new o.r(3259730800,3505952657),new o.r(3345764771,106217008),new o.r(3516065817,3606008344),new o.r(3600352804,1432725776),new o.r(4094571909,1467031594),new o.r(275423344,851169720),new o.r(430227734,3100823752),new o.r(506948616,1363258195),new o.r(659060556,3750685593),new o.r(883997877,3785050280),new o.r(958139571,3318307427),new o.r(1322822218,3812723403),new o.r(1537002063,2003034995),new o.r(1747873779,3602036899),new o.r(1955562222,1575990012),new o.r(2024104815,1125592928),new o.r(2227730452,2716904306),new o.r(2361852424,442776044),new o.r(2428436474,593698344),new o.r(2756734187,3733110249),new o.r(3204031479,2999351573),new o.r(3329325298,3815920427),new o.r(3391569614,3928383900),new o.r(3515267271,566280711),new o.r(3940187606,3454069534),new o.r(4118630271,4000239992),new o.r(116418474,1914138554),new o.r(174292421,2731055270),new o.r(289380356,3203993006),new o.r(460393269,320620315),new o.r(685471733,587496836),new o.r(852142971,1086792851),new o.r(1017036298,365543100),new o.r(1126000580,2618297676),new o.r(1288033470,3409855158),new o.r(1501505948,4234509866),new o.r(1607167915,987167468),new o.r(1816402316,1246189591)],c=[];!function(){for(var n=0;n<80;n++)c[n]=new o.r(0,0)}();var s=function(n){function t(t){var e=n.call(this,t)||this;return e.h=32,e.v=new o.m([new o.r(1779033703,4089235720),new o.r(3144134277,2227873595),new o.r(1013904242,4271175723),new o.r(2773480762,1595750129),new o.r(1359893119,2917565137),new o.r(2600822924,725511199),new o.r(528734635,4215389547),new o.r(1541459225,327033209)]),e.l=t,t&&void 0!==t.hash&&(e.v=t.hash.clone()),e}return u(t,n),t.prototype.j=function(){this.v=new o.m([new o.r(1779033703,4089235720),new o.r(3144134277,2227873595),new o.r(1013904242,4271175723),new o.r(2773480762,1595750129),new o.r(1359893119,2917565137),new o.r(2600822924,725511199),new o.r(528734635,4215389547),new o.r(1541459225,327033209)])},t.prototype.A=function(n,t){for(var e=this.v.words,r=e[0],i=e[1],o=e[2],u=e[3],s=e[4],w=e[5],a=e[6],h=e[7],v=r.high,d=r.low,l=i.high,b=i.low,y=o.high,p=o.low,m=u.high,g=u.low,j=s.high,A=s.low,O=w.high,I=w.low,E=a.high,M=a.low,S=h.high,U=h.low,_=v,N=d,x=l,H=b,C=y,F=p,B=m,k=g,z=j,T=A,P=O,R=I,q=E,$=M,D=S,G=U,J=0;J<80;J++){var K=void 0,L=void 0,Q=c[J];if(J<16)L=Q.high=0|n[t+2*J],K=Q.low=0|n[t+2*J+1];else{var V=c[J-15],W=V.high,X=V.low,Y=(W>>>1|X<<31)^(W>>>8|X<<24)^W>>>7,Z=(X>>>1|W<<31)^(X>>>8|W<<24)^(X>>>7|W<<25),nn=c[J-2],tn=nn.high,en=nn.low,rn=(tn>>>19|en<<13)^(tn<<3|en>>>29)^tn>>>6,on=(en>>>19|tn<<13)^(en<<3|tn>>>29)^(en>>>6|tn<<26),un=c[J-7],fn=un.high,cn=un.low,sn=c[J-16],wn=sn.high,an=sn.low;L=(L=(L=Y+fn+((K=Z+cn)>>>0<Z>>>0?1:0))+rn+((K+=on)>>>0<on>>>0?1:0))+wn+((K+=an)>>>0<an>>>0?1:0),Q.high=L,Q.low=K}var hn=z&P^~z&q,vn=T&R^~T&$,dn=_&x^_&C^x&C,ln=N&H^N&F^H&F,bn=(_>>>28|N<<4)^(_<<30|N>>>2)^(_<<25|N>>>7),yn=(N>>>28|_<<4)^(N<<30|_>>>2)^(N<<25|_>>>7),pn=(z>>>14|T<<18)^(z>>>18|T<<14)^(z<<23|T>>>9),mn=(T>>>14|z<<18)^(T>>>18|z<<14)^(T<<23|z>>>9),gn=f[J],jn=gn.high,An=gn.low,On=G+mn,In=D+pn+(On>>>0<G>>>0?1:0),En=yn+ln;D=q,G=$,q=P,$=R,P=z,R=T,z=B+(In=(In=(In=In+hn+((On+=vn)>>>0<vn>>>0?1:0))+jn+((On+=An)>>>0<An>>>0?1:0))+L+((On+=K)>>>0<K>>>0?1:0))+((T=k+On|0)>>>0<k>>>0?1:0)|0,B=C,k=F,C=x,F=H,x=_,H=N,_=In+(bn+dn+(En>>>0<yn>>>0?1:0))+((N=On+En|0)>>>0<On>>>0?1:0)|0}d=r.low=d+N,r.high=v+_+(d>>>0<N>>>0?1:0),b=i.low=b+H,i.high=l+x+(b>>>0<H>>>0?1:0),p=o.low=p+F,o.high=y+C+(p>>>0<F>>>0?1:0),g=u.low=g+k,u.high=m+B+(g>>>0<k>>>0?1:0),A=s.low=A+T,s.high=j+z+(A>>>0<T>>>0?1:0),I=w.low=I+R,w.high=O+P+(I>>>0<R>>>0?1:0),M=a.low=M+$,a.high=E+q+(M>>>0<$>>>0?1:0),U=h.low=U+G,h.high=S+D+(U>>>0<G>>>0?1:0)},t.prototype.O=function(){var n=this.I,t=n.words,e=8*this.S,r=8*n.nSigBytes;return t[r>>>5]|=128<<24-r%32,t[30+(r+128>>>10<<5)]=Math.floor(e/4294967296),t[31+(r+128>>>10<<5)]=e,n.nSigBytes=4*t.length,this.U(),this.v.to32()},t.prototype.clone=function(){return new t({hash:this.v,blockSize:this.h,data:this.I,nBytes:this.S})},t.hash=function(n,e){return new t(e).finalize(n)},t}(i.P)},3354:function(n,t,e){e.d(t,{e:function(){return o}});var r=e(5720),i=e(9054),o=function(){function n(t,e){if(Array.isArray(t)||!t)return this._=Array.isArray(t)?t:[],void(this.N="number"==typeof e?e:4*this._.length);if(t instanceof n)return this._=t.words.slice(),void(this.N=t.nSigBytes);var r;try{t instanceof ArrayBuffer?r=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!r)throw new Error("Invalid argument");for(var i=r.byteLength,o=[],u=0;u<i;u++)o[u>>>2]|=r[u]<<24-u%4*8;this._=o,this.N=i}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.N},set:function(n){this.N=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this._},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):r.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this._,t=this.N,e=new Uint8Array(t),r=0;r<t;r++)e[r]=n[r>>>2]>>>24-r%4*8&255;return e},n.prototype.concat=function(n){var t=n.words.slice(),e=n.nSigBytes;if(this.clamp(),this.N%4)for(var r=0;r<e;r++){var i=t[r>>>2]>>>24-r%4*8&255;this._[this.N+r>>>2]|=i<<24-(this.N+r)%4*8}else for(r=0;r<e;r+=4)this._[this.N+r>>>2]=t[r>>>2];return this.N+=e,this},n.prototype.clamp=function(){var n=this.N;this._[n>>>2]&=4294967295<<32-n%4*8,this._.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this._.slice(),this.N)},n.random=function(t){for(var e=[],r=0;r<t;r+=4)e.push((0,i.M)());return new n(e,t)},n}()},6957:function(n,t,e){e.d(t,{r:function(){return o},m:function(){return u}});var r=e(5720),i=e(3354),o=function(){function n(n,t){this.high=n,this.low=t}return n.prototype.clone=function(){return new n(this.high,this.low)},n}(),u=function(){function n(n,t){this._=n||[],this.N="number"==typeof t?t:8*this._.length}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.N},set:function(n){this.N=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this._},enumerable:!1,configurable:!0}),n.prototype.to32=function(){for(var n=[],t=0;t<this._.length;t++){var e=this._[t];n.push(e.high),n.push(e.low)}return new i.e(n,this.N)},n.prototype.toString=function(n){return n?n.stringify(this.to32()):r.p.stringify(this.to32())},n.prototype.clone=function(){for(var t=this._.slice(),e=0;e<t.length;e++)t[e]=t[e].clone();return new n(t,this.N)},n}()},7211:function(n,t,e){e.d(t,{C:function(){return o}});var r=e(3354),i=e(4768),o=function(){function n(n){this.H=0,this.h=0,this.l=n,this.I=n&&void 0!==n.data?n.data.clone():new r.e,this.S=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.h},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.I=void 0!==n?n.clone():new r.e,this.S="number"==typeof t?t:0},n.prototype.F=function(n){var t="string"==typeof n?i.d.parse(n):n;this.I.concat(t),this.S+=t.nSigBytes},n.prototype.U=function(n){var t,e=this.I.words,i=this.I.nSigBytes,o=this.h,u=i/(4*this.h),f=(u=n?Math.ceil(u):Math.max((0|u)-this.H,0))*o,c=Math.min(4*f,i);if(f){for(var s=0;s<f;s+=o)this.A(e,s);t=e.splice(0,f),this.I.nSigBytes-=c}return new r.e(t,c)},n.prototype.A=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,e){e.d(t,{P:function(){return u}});var r,i=e(7211),o=(r=function(n,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])})(n,t)},function(n,t){function e(){this.constructor=n}r(n,t),n.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),u=function(n){function t(t){var e=n.call(this,t)||this;return e.h=16,e.l=t,t&&"number"==typeof t.blockSize&&(e.h=t.blockSize),e.reset(t?t.data:void 0,t?t.nBytes:void 0),e}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.h},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,e){n.prototype.reset.call(this,t,e),this.j()},t.prototype.update=function(n){return this.F(n),this.U(),this},t.prototype.finalize=function(n){return n&&this.F(n),this.O()},t.prototype.j=function(){throw new Error("Not implemented")},t.prototype.O=function(){throw new Error("Not implemented")},t}(i.C)},1756:function(n,t,e){e.d(t,{w:function(){return u}});var r,i="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(r=parseInt((/msie (\d+)/.exec(i)||[])[1],10),isNaN(r)?(r=parseInt((/trident\/.*; rv:(\d+)/.exec(i)||[])[1],10),!isNaN(r)&&r):r);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},5720:function(n,t,e){e.d(t,{p:function(){return i}});var r=e(3354),i={stringify:function(n){for(var t=n.nSigBytes,e=n.words,r=[],i=0;i<t;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var e=[],i=0;i<t;i+=2)e[i>>>3]|=parseInt(n.substr(i,2),16)<<24-i%8*4;return new r.e(e,t/2)}}},8702:function(n,t,e){e.d(t,{m:function(){return i}});var r=e(3354),i={stringify:function(n){for(var t=n.nSigBytes,e=n.words,r=[],i=0;i<t;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(n){for(var t=n.length,e=[],i=0;i<t;i++)e[i>>>2]|=(255&n.charCodeAt(i))<<24-i%4*8;return new r.e(e,t)}}},4768:function(n,t,e){e.d(t,{d:function(){return i}});var r=e(8702),i={stringify:function(n){try{return decodeURIComponent(escape(r.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return r.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,e){e.d(t,{M:function(){return i}});var r=e(1756);var i=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,r.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==e.g&&e.g.crypto?function(){return e.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function e(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return n[r](o,o.exports,e),o.exports}e.d=function(n,t){for(var r in t)e.o(t,r)&&!e.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:t[r]})},e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),e.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},e.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"B",{value:!0})};var r={};return function(){e.r(r),e.d(r,{HmacSHA512:function(){return i}});var n=e(6367),t=e(7491);function i(e,r){return new n.Hmac(new t.SHA512,r).finalize(e)}}(),r}()}));
\ No newline at end of file
... ...
  1 +The MIT License
  2 +
  3 +Copyright (c) 2019 Izumi Hoshino <rindo.hinase@gmail.com>
  4 +
  5 +Permission is hereby granted, free of charge, to any person obtaining a copy
  6 +of this software and associated documentation files (the "Software"), to deal
  7 +in the Software without restriction, including without limitation the rights
  8 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9 +copies of the Software, and to permit persons to whom the Software is
  10 +furnished to do so, subject to the following conditions:
  11 +
  12 +The above copyright notice and this permission notice shall be included in
  13 +all copies or substantial portions of the Software.
  14 +
  15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21 +THE SOFTWARE.
\ No newline at end of file
... ...
  1 +export { Latin1 } from "./lib/encoder/Latin1";
... ...
  1 +!function(n,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r();else if("function"==typeof define&&define.amd)define([],r);else if("object"==typeof exports)exports.JsCrypto=r();else{var t=r();for(var e in n.JsCrypto=n.JsCrypto||{},t)n.JsCrypto[e]=t[e]}}(this,(function(){return function(){"use strict";var n={d:function(r,t){for(var e in t)n.o(t,e)&&!n.o(r,e)&&Object.defineProperty(r,e,{enumerable:!0,get:t[e]})}};n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),n.o=function(n,r){return Object.prototype.hasOwnProperty.call(n,r)},n.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"t",{value:!0})};var r={};n.r(r),n.d(r,{Latin1:function(){return u}});var t,e=function(n){for(var r=n.nSigBytes,t=n.words,e=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;e.push((o>>>4).toString(16)),e.push((15&o).toString(16))}return e.join("")},i="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(t=parseInt((/msie (\d+)/.exec(i)||[])[1],10),isNaN(t)?(t=parseInt((/trident\/.*; rv:(\d+)/.exec(i)||[])[1],10),!isNaN(t)&&t):t);var a=function(){if("undefined"!=typeof window){var r=window.crypto||window.msCrypto;if(!r){if(function(n,r){return!1!==o&&(!r||("<"===n?o<r:"<="===n?o<=r:">"===n?o>r:">="===n?o>=r:o===r))}("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return r.getRandomValues(new Uint32Array(1))[0]}}return void 0!==n.g&&n.g.crypto?function(){return n.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}(),f=function(){function n(r,t){if(Array.isArray(r)||!r)return this.i=Array.isArray(r)?r:[],void(this.u="number"==typeof t?t:4*this.i.length);if(r instanceof n)return this.i=r.words.slice(),void(this.u=r.nSigBytes);var e;try{r instanceof ArrayBuffer?e=new Uint8Array(r):(r instanceof Uint8Array||r instanceof Int8Array||r instanceof Uint8ClampedArray||r instanceof Int16Array||r instanceof Uint16Array||r instanceof Int32Array||r instanceof Uint32Array||r instanceof Float32Array||r instanceof Float64Array)&&(e=new Uint8Array(r.buffer,r.byteOffset,r.byteLength))}catch(n){throw new Error("Invalid argument")}if(!e)throw new Error("Invalid argument");for(var i=e.byteLength,o=[],a=0;a<i;a++)o[a>>>2]|=e[a]<<24-a%4*8;this.i=o,this.u=i}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.u},set:function(n){this.u=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.i},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):e(this)},n.prototype.toUint8Array=function(){for(var n=this.i,r=this.u,t=new Uint8Array(r),e=0;e<r;e++)t[e]=n[e>>>2]>>>24-e%4*8&255;return t},n.prototype.concat=function(n){var r=n.words.slice(),t=n.nSigBytes;if(this.clamp(),this.u%4)for(var e=0;e<t;e++){var i=r[e>>>2]>>>24-e%4*8&255;this.i[this.u+e>>>2]|=i<<24-(this.u+e)%4*8}else for(e=0;e<t;e+=4)this.i[this.u+e>>>2]=r[e>>>2];return this.u+=t,this},n.prototype.clamp=function(){var n=this.u;this.i[n>>>2]&=4294967295<<32-n%4*8,this.i.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.i.slice(),this.u)},n.random=function(r){for(var t=[],e=0;e<r;e+=4)t.push(a());return new n(t,r)},n}(),u={stringify:function(n){for(var r=n.nSigBytes,t=n.words,e=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;e.push(String.fromCharCode(o))}return e.join("")},parse:function(n){for(var r=n.length,t=[],e=0;e<r;e++)t[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new f(t,r)}};return r}()}));
\ No newline at end of file
... ...
  1 +import { Word32Array } from "./lib/Word32Array";
  2 +import { Hasher, HasherProps } from "./lib/algorithm/Hasher";
  3 +export interface MD5Props extends HasherProps {
  4 + hash: Word32Array;
  5 +}
  6 +/**
  7 + * MD5 hash algorithm
  8 + */
  9 +export declare class MD5 extends Hasher {
  10 + private _hash;
  11 + constructor(props?: MD5Props);
  12 + protected _doReset(): void;
  13 + protected _doProcessBlock(words: number[], offset: number): void;
  14 + protected _doFinalize(): Word32Array;
  15 + clone(): MD5;
  16 + static hash(message: Word32Array | string): Word32Array;
  17 +}
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var i in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[i]=r[i]}}(this,(function(){return function(){"use strict";var n={3354:function(n,t,r){r.d(t,{e:function(){return o}});var i=r(5720),e=r(9054),o=function(){function n(t,r){if(Array.isArray(t)||!t)return this.t=Array.isArray(t)?t:[],void(this.i="number"==typeof r?r:4*this.t.length);if(t instanceof n)return this.t=t.words.slice(),void(this.i=t.nSigBytes);var i;try{t instanceof ArrayBuffer?i=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!i)throw new Error("Invalid argument");for(var e=i.byteLength,o=[],u=0;u<e;u++)o[u>>>2]|=i[u]<<24-u%4*8;this.t=o,this.i=e}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.i},set:function(n){this.i=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.t},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):i.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.t,t=this.i,r=new Uint8Array(t),i=0;i<t;i++)r[i]=n[i>>>2]>>>24-i%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.i%4)for(var i=0;i<r;i++){var e=t[i>>>2]>>>24-i%4*8&255;this.t[this.i+i>>>2]|=e<<24-(this.i+i)%4*8}else for(i=0;i<r;i+=4)this.t[this.i+i>>>2]=t[i>>>2];return this.i+=r,this},n.prototype.clamp=function(){var n=this.i;this.t[n>>>2]&=4294967295<<32-n%4*8,this.t.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.t.slice(),this.i)},n.random=function(t){for(var r=[],i=0;i<t;i+=4)r.push((0,e.M)());return new n(r,t)},n}()},7211:function(n,t,r){r.d(t,{C:function(){return o}});var i=r(3354),e=r(4768),o=function(){function n(n){this.u=0,this.h=0,this.v=n,this.l=n&&void 0!==n.data?n.data.clone():new i.e,this.j=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.h},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.l=void 0!==n?n.clone():new i.e,this.j="number"==typeof t?t:0},n.prototype.A=function(n){var t="string"==typeof n?e.d.parse(n):n;this.l.concat(t),this.j+=t.nSigBytes},n.prototype.O=function(n){var t,r=this.l.words,e=this.l.nSigBytes,o=this.h,u=e/(4*this.h),f=(u=n?Math.ceil(u):Math.max((0|u)-this.u,0))*o,a=Math.min(4*f,e);if(f){for(var c=0;c<f;c+=o)this.I(r,c);t=r.splice(0,f),this.l.nSigBytes-=a}return new i.e(t,a)},n.prototype.I=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,r){r.d(t,{P:function(){return u}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.h=16,r.v=t,t&&"number"==typeof t.blockSize&&(r.h=t.blockSize),r.reset(t?t.data:void 0,t?t.nBytes:void 0),r}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.h},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.U()},t.prototype.update=function(n){return this.A(n),this.O(),this},t.prototype.finalize=function(n){return n&&this.A(n),this._()},t.prototype.U=function(){throw new Error("Not implemented")},t.prototype._=function(){throw new Error("Not implemented")},t}(e.C)},1756:function(n,t,r){r.d(t,{w:function(){return u}});var i,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(i=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(i)?(i=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(i)&&i):i);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},5720:function(n,t,r){r.d(t,{p:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],e=0;e<t;e+=2)r[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new i.e(r,t/2)}}},8702:function(n,t,r){r.d(t,{m:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(n){for(var t=n.length,r=[],e=0;e<t;e++)r[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new i.e(r,t)}}},4768:function(n,t,r){r.d(t,{d:function(){return e}});var i=r(8702),e={stringify:function(n){try{return decodeURIComponent(escape(i.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return i.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,r){r.d(t,{M:function(){return e}});var i=r(1756);var e=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,i.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function r(i){var e=t[i];if(void 0!==e)return e.exports;var o=t[i]={exports:{}};return n[i](o,o.exports,r),o.exports}r.d=function(n,t){for(var i in t)r.o(t,i)&&!r.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"S",{value:!0})};var i={};return function(){r.r(i),r.d(i,{MD5:function(){return h}});var n,t=r(3354),e=r(1868),o=(n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(t,r)},function(t,r){function i(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}),u=[];function f(n,t,r,i,e,o,u){var f=n+(t&r|~t&i)+e+u;return(f<<o|f>>>32-o)+t}function a(n,t,r,i,e,o,u){var f=n+(t&i|r&~i)+e+u;return(f<<o|f>>>32-o)+t}function c(n,t,r,i,e,o,u){var f=n+(t^r^i)+e+u;return(f<<o|f>>>32-o)+t}function s(n,t,r,i,e,o,u){var f=n+(r^(t|~i))+e+u;return(f<<o|f>>>32-o)+t}!function(){for(var n=0;n<64;n++)u[n]=4294967296*Math.abs(Math.sin(n+1))|0}();var h=function(n){function r(r){var i=n.call(this,r)||this;return i.N=new t.e([1732584193,4023233417,2562383102,271733878]),r&&void 0!==r.hash&&(i.N=r.hash.clone()),i}return o(r,n),r.prototype.U=function(){this.N=new t.e([1732584193,4023233417,2562383102,271733878])},r.prototype.I=function(n,t){for(var r=0;r<16;r++){var i=t+r,e=n[i];n[i]=16711935&(e<<8|e>>>24)|4278255360&(e<<24|e>>>8)}var o=this.N.words,h=n[t],v=n[t+1],d=n[t+2],w=n[t+3],l=n[t+4],y=n[t+5],b=n[t+6],p=n[t+7],m=n[t+8],g=n[t+9],j=n[t+10],A=n[t+11],M=n[t+12],O=n[t+13],I=n[t+14],E=n[t+15],U=o[0],_=o[1],S=o[2],N=o[3];U=f(U,_,S,N,h,7,u[0]),N=f(N,U,_,S,v,12,u[1]),S=f(S,N,U,_,d,17,u[2]),_=f(_,S,N,U,w,22,u[3]),U=f(U,_,S,N,l,7,u[4]),N=f(N,U,_,S,y,12,u[5]),S=f(S,N,U,_,b,17,u[6]),_=f(_,S,N,U,p,22,u[7]),U=f(U,_,S,N,m,7,u[8]),N=f(N,U,_,S,g,12,u[9]),S=f(S,N,U,_,j,17,u[10]),_=f(_,S,N,U,A,22,u[11]),U=f(U,_,S,N,M,7,u[12]),N=f(N,U,_,S,O,12,u[13]),S=f(S,N,U,_,I,17,u[14]),U=a(U,_=f(_,S,N,U,E,22,u[15]),S,N,v,5,u[16]),N=a(N,U,_,S,b,9,u[17]),S=a(S,N,U,_,A,14,u[18]),_=a(_,S,N,U,h,20,u[19]),U=a(U,_,S,N,y,5,u[20]),N=a(N,U,_,S,j,9,u[21]),S=a(S,N,U,_,E,14,u[22]),_=a(_,S,N,U,l,20,u[23]),U=a(U,_,S,N,g,5,u[24]),N=a(N,U,_,S,I,9,u[25]),S=a(S,N,U,_,w,14,u[26]),_=a(_,S,N,U,m,20,u[27]),U=a(U,_,S,N,O,5,u[28]),N=a(N,U,_,S,d,9,u[29]),S=a(S,N,U,_,p,14,u[30]),U=c(U,_=a(_,S,N,U,M,20,u[31]),S,N,y,4,u[32]),N=c(N,U,_,S,m,11,u[33]),S=c(S,N,U,_,A,16,u[34]),_=c(_,S,N,U,I,23,u[35]),U=c(U,_,S,N,v,4,u[36]),N=c(N,U,_,S,l,11,u[37]),S=c(S,N,U,_,p,16,u[38]),_=c(_,S,N,U,j,23,u[39]),U=c(U,_,S,N,O,4,u[40]),N=c(N,U,_,S,h,11,u[41]),S=c(S,N,U,_,w,16,u[42]),_=c(_,S,N,U,b,23,u[43]),U=c(U,_,S,N,g,4,u[44]),N=c(N,U,_,S,M,11,u[45]),S=c(S,N,U,_,E,16,u[46]),U=s(U,_=c(_,S,N,U,d,23,u[47]),S,N,h,6,u[48]),N=s(N,U,_,S,p,10,u[49]),S=s(S,N,U,_,I,15,u[50]),_=s(_,S,N,U,y,21,u[51]),U=s(U,_,S,N,M,6,u[52]),N=s(N,U,_,S,w,10,u[53]),S=s(S,N,U,_,j,15,u[54]),_=s(_,S,N,U,v,21,u[55]),U=s(U,_,S,N,m,6,u[56]),N=s(N,U,_,S,E,10,u[57]),S=s(S,N,U,_,b,15,u[58]),_=s(_,S,N,U,O,21,u[59]),U=s(U,_,S,N,l,6,u[60]),N=s(N,U,_,S,A,10,u[61]),S=s(S,N,U,_,d,15,u[62]),_=s(_,S,N,U,g,21,u[63]),o[0]=o[0]+U|0,o[1]=o[1]+_|0,o[2]=o[2]+S|0,o[3]=o[3]+N|0},r.prototype._=function(){var n=this.l,t=n.words,r=8*this.j,i=8*n.nSigBytes;t[i>>>5]|=128<<24-i%32;var e=Math.floor(r/4294967296),o=r;t[15+(i+64>>>9<<4)]=16711935&(e<<8|e>>>24)|4278255360&(e<<24|e>>>8),t[14+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n.nSigBytes=4*(t.length+1),this.O();for(var u=this.N,f=u.words,a=0;a<4;a++){var c=f[a];f[a]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return u},r.prototype.clone=function(){return new r({hash:this.N,blockSize:this.h,data:this.l,nBytes:this.j})},r.hash=function(n){return(new r).finalize(n)},r}(e.P)}(),i}()}));
\ No newline at end of file
... ...
  1 +export { OpenSSLKDF } from "./lib/algorithm/cipher/kdf/OpenSSLKDF";
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var i in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[i]=r[i]}}(this,(function(){return function(){"use strict";var n={6367:function(n,t,r){r.d(t,{Hmac:function(){return e}});var i=r(4768),e=function(){function n(n,t){this.t=n,"string"==typeof t&&(t=i.d.parse(t));var r=n.blockSize,e=4*r;t.nSigBytes>e&&(t=n.finalize(t)),t.clamp();for(var o=this.i=t.clone(),u=this.u=t.clone(),f=o.words,c=u.words,s=0;s<r;s++)f[s]^=1549556828,c[s]^=909522486;u.nSigBytes=e,o.nSigBytes=e,this.reset()}return n.prototype.reset=function(){this.t.reset(),this.t.update(this.u)},n.prototype.update=function(n){return this.t.update(n),this},n.prototype.finalize=function(n){var t=this.t.finalize(n);return this.t.reset(),this.t.finalize(this.i.clone().concat(t))},n}()},5561:function(n,t,r){r.d(t,{SHA256:function(){return v}});var i,e=r(1868),o=r(3354),u=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),f=[],c=[];function s(n){for(var t=Math.sqrt(n),r=2;r<=t;r++)if(!(n%r))return!1;return!0}function a(n){return 4294967296*(n-(0|n))|0}!function(){for(var n=2,t=0;t<64;)s(n)&&(t<8&&(f[t]=a(Math.pow(n,.5))),c[t]=a(Math.pow(n,1/3)),t++),n++}();var h=[],v=function(n){function t(t){var r=n.call(this,t)||this;return r.h=new o.e(f.slice(0)),r.v=t,t&&void 0!==t.hash&&(r.h=t.hash.clone()),r}return u(t,n),t.prototype.l=function(){this.h=new o.e(f.slice(0))},t.prototype.j=function(n,t){for(var r=this.h.words,i=r[0],e=r[1],o=r[2],u=r[3],f=r[4],s=r[5],a=r[6],v=r[7],w=0;w<64;w++){if(w<16)h[w]=0|n[t+w];else{var d=h[w-15],l=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,y=h[w-2],b=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;h[w]=l+h[w-7]+b+h[w-16]}var p=i&e^i&o^e&o,m=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),g=v+((f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25))+(f&s^~f&a)+c[w]+h[w];v=a,a=s,s=f,f=u+g|0,u=o,o=e,e=i,i=g+(m+p)|0}r[0]=r[0]+i|0,r[1]=r[1]+e|0,r[2]=r[2]+o|0,r[3]=r[3]+u|0,r[4]=r[4]+f|0,r[5]=r[5]+s|0,r[6]=r[6]+a|0,r[7]=r[7]+v|0},t.prototype.A=function(){var n=this.O.words,t=8*this.I,r=8*this.O.nSigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=Math.floor(t/4294967296),n[15+(r+64>>>9<<4)]=t,this.O.nSigBytes=4*n.length,this._(),this.h},t.prototype.clone=function(){return new t({hash:this.h,blockSize:this.S,data:this.O,nBytes:this.I})},t.hash=function(n,r){return new t(r).finalize(n)},t}(e.P)},3354:function(n,t,r){r.d(t,{e:function(){return o}});var i=r(5720),e=r(9054),o=function(){function n(t,r){if(Array.isArray(t)||!t)return this.U=Array.isArray(t)?t:[],void(this.N="number"==typeof r?r:4*this.U.length);if(t instanceof n)return this.U=t.words.slice(),void(this.N=t.nSigBytes);var i;try{t instanceof ArrayBuffer?i=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!i)throw new Error("Invalid argument");for(var e=i.byteLength,o=[],u=0;u<e;u++)o[u>>>2]|=i[u]<<24-u%4*8;this.U=o,this.N=e}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.N},set:function(n){this.N=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.U},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):i.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.U,t=this.N,r=new Uint8Array(t),i=0;i<t;i++)r[i]=n[i>>>2]>>>24-i%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.N%4)for(var i=0;i<r;i++){var e=t[i>>>2]>>>24-i%4*8&255;this.U[this.N+i>>>2]|=e<<24-(this.N+i)%4*8}else for(i=0;i<r;i+=4)this.U[this.N+i>>>2]=t[i>>>2];return this.N+=r,this},n.prototype.clamp=function(){var n=this.N;this.U[n>>>2]&=4294967295<<32-n%4*8,this.U.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.U.slice(),this.N)},n.random=function(t){for(var r=[],i=0;i<t;i+=4)r.push((0,e.M)());return new n(r,t)},n}()},7211:function(n,t,r){r.d(t,{C:function(){return o}});var i=r(3354),e=r(4768),o=function(){function n(n){this.F=0,this.S=0,this.v=n,this.O=n&&void 0!==n.data?n.data.clone():new i.e,this.I=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.S},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.O=void 0!==n?n.clone():new i.e,this.I="number"==typeof t?t:0},n.prototype.k=function(n){var t="string"==typeof n?e.d.parse(n):n;this.O.concat(t),this.I+=t.nSigBytes},n.prototype._=function(n){var t,r=this.O.words,e=this.O.nSigBytes,o=this.S,u=e/(4*this.S),f=(u=n?Math.ceil(u):Math.max((0|u)-this.F,0))*o,c=Math.min(4*f,e);if(f){for(var s=0;s<f;s+=o)this.j(r,s);t=r.splice(0,f),this.O.nSigBytes-=c}return new i.e(t,c)},n.prototype.j=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,r){r.d(t,{P:function(){return u}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.S=16,r.v=t,t&&"number"==typeof t.blockSize&&(r.S=t.blockSize),r.reset(t?t.data:void 0,t?t.nBytes:void 0),r}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.S},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.l()},t.prototype.update=function(n){return this.k(n),this._(),this},t.prototype.finalize=function(n){return n&&this.k(n),this.A()},t.prototype.l=function(){throw new Error("Not implemented")},t.prototype.A=function(){throw new Error("Not implemented")},t}(e.C)},1756:function(n,t,r){r.d(t,{w:function(){return u}});var i,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(i=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(i)?(i=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(i)&&i):i);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},5720:function(n,t,r){r.d(t,{p:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],e=0;e<t;e+=2)r[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new i.e(r,t/2)}}},8702:function(n,t,r){r.d(t,{m:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(n){for(var t=n.length,r=[],e=0;e<t;e++)r[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new i.e(r,t)}}},4768:function(n,t,r){r.d(t,{d:function(){return e}});var i=r(8702),e={stringify:function(n){try{return decodeURIComponent(escape(i.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return i.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,r){r.d(t,{M:function(){return e}});var i=r(1756);var e=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,i.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function r(i){var e=t[i];if(void 0!==e)return e.exports;var o=t[i]={exports:{}};return n[i](o,o.exports,r),o.exports}r.d=function(n,t){for(var i in t)r.o(t,i)&&!r.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"H",{value:!0})};var i={};return function(){r.r(i),r.d(i,{OpenSSLKDF:function(){return y}});for(var n=r(3354),t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",e=[],o=0;o<t.length;o++)e[t.charCodeAt(o)]=o;var u,f={stringify:function(n){var r=n.words,i=n.nSigBytes;n.clamp();for(var e=[],o=0;o<i;o+=3)for(var u=(r[o>>>2]>>>24-o%4*8&255)<<16|(r[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|r[o+2>>>2]>>>24-(o+2)%4*8&255,f=0;f<4&&o+.75*f<i;f++)e.push(t.charAt(u>>>6*(3-f)&63));var c=t.charAt(64);if(c)for(;e.length%4;)e.push(c);return e.join("")},parse:function(r){var i=r.length,o=t.charAt(64);if(o){var u=r.indexOf(o);-1!==u&&(i=u)}for(var f=[],c=0,s=0;s<i;s++)if(s%4){var a=e[r.charCodeAt(s-1)]<<s%4*2|e[r.charCodeAt(s)]>>>6-s%4*2;f[c>>>2]|=a<<24-c%4*8,c++}return new n.e(f,c)}},c={stringify:function(t){var r=t.cipherText,i=t.salt;return r?i?new n.e([1398893684,1701076831]).concat(i).concat(r).toString(f):r.toString(f):""},parse:function(t){var r,i=f.parse(t),e=i.words;return 1398893684===e[0]&&1701076831===e[1]&&(r=new n.e(e.slice(2,4)),e.splice(0,4),i.nSigBytes-=16),new s({cipherText:i,salt:r})}},s=function(){function n(n){this.formatter=c,n&&(this.cipherText=n.cipherText,this.key=n.key,this.iv=n.iv,this.salt=n.salt,this.Algorithm=n.Algorithm,this.mode=n.mode,this.padding=n.padding,this.blockSize=n.blockSize,this.formatter=n.formatter||c)}return n.prototype.toString=function(n){return(n||this.formatter).stringify(this)},n}(),a=r(5561),h=r(6367),v=function(){function n(n){this.v=n}return n.prototype.compute=function(n,t){throw new Error("Not implemented")},n.getKey=function(n,t,r){throw new Error("Not implemented")},n}(),w=(u=function(n,t){return(u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}u(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),d=function(t){function r(n){var r=t.call(this,n)||this;return r.T=4,r.B=a.SHA256,r.R=1e4,n&&(r.T=void 0!==n.keySize?n.keySize:r.T,r.B=void 0!==n.Hasher?n.Hasher:r.B,r.R=void 0!==n.iterations?n.iterations:r.R),r}return w(r,t),r.prototype.compute=function(t,r){for(var i=new h.Hmac(new this.B,t),e=new n.e,o=new n.e([1]),u=e.words,f=o.words,c=this.T,s=this.R;u.length<c;){var a=i.update(r).finalize(o);i.reset();for(var v=a.words,w=v.length,d=a,l=1;l<s;l++){d=i.finalize(d),i.reset();for(var y=d.words,b=0;b<w;b++)v[b]^=y[b]}e.concat(a),f[0]++}return e.nSigBytes=4*c,e},r.getKey=function(n,t,i){return new r(i).compute(n,t)},r}(v),l=function(){return(l=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},y={execute:function(t,r,i,e,o){e||(e=n.e.random(8));var u=o&&o.kdfModule||d,f=o?{Hasher:o.kdfHasher,iterations:o.kdfIterations}:{},c=u.getKey(t,e,l(l({},f),{keySize:r+i})),a=new n.e(c.words.slice(r),4*i);return c.nSigBytes=4*r,new s({key:c,iv:a,salt:e})}}}(),i}()}));
\ No newline at end of file
... ...
  1 +export { PBKDF2 } from "./lib/algorithm/cipher/kdf/module/PBKDF2";
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var i in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[i]=r[i]}}(this,(function(){return function(){"use strict";var n={6367:function(n,t,r){r.d(t,{Hmac:function(){return e}});var i=r(4768),e=function(){function n(n,t){this.t=n,"string"==typeof t&&(t=i.d.parse(t));var r=n.blockSize,e=4*r;t.nSigBytes>e&&(t=n.finalize(t)),t.clamp();for(var o=this.i=t.clone(),u=this.u=t.clone(),f=o.words,c=u.words,s=0;s<r;s++)f[s]^=1549556828,c[s]^=909522486;u.nSigBytes=e,o.nSigBytes=e,this.reset()}return n.prototype.reset=function(){this.t.reset(),this.t.update(this.u)},n.prototype.update=function(n){return this.t.update(n),this},n.prototype.finalize=function(n){var t=this.t.finalize(n);return this.t.reset(),this.t.finalize(this.i.clone().concat(t))},n}()},5561:function(n,t,r){r.d(t,{SHA256:function(){return v}});var i,e=r(1868),o=r(3354),u=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),f=[],c=[];function s(n){for(var t=Math.sqrt(n),r=2;r<=t;r++)if(!(n%r))return!1;return!0}function a(n){return 4294967296*(n-(0|n))|0}!function(){for(var n=2,t=0;t<64;)s(n)&&(t<8&&(f[t]=a(Math.pow(n,.5))),c[t]=a(Math.pow(n,1/3)),t++),n++}();var h=[],v=function(n){function t(t){var r=n.call(this,t)||this;return r.h=new o.e(f.slice(0)),r.v=t,t&&void 0!==t.hash&&(r.h=t.hash.clone()),r}return u(t,n),t.prototype.l=function(){this.h=new o.e(f.slice(0))},t.prototype.j=function(n,t){for(var r=this.h.words,i=r[0],e=r[1],o=r[2],u=r[3],f=r[4],s=r[5],a=r[6],v=r[7],w=0;w<64;w++){if(w<16)h[w]=0|n[t+w];else{var d=h[w-15],l=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,y=h[w-2],b=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;h[w]=l+h[w-7]+b+h[w-16]}var p=i&e^i&o^e&o,m=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),g=v+((f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25))+(f&s^~f&a)+c[w]+h[w];v=a,a=s,s=f,f=u+g|0,u=o,o=e,e=i,i=g+(m+p)|0}r[0]=r[0]+i|0,r[1]=r[1]+e|0,r[2]=r[2]+o|0,r[3]=r[3]+u|0,r[4]=r[4]+f|0,r[5]=r[5]+s|0,r[6]=r[6]+a|0,r[7]=r[7]+v|0},t.prototype.A=function(){var n=this.O.words,t=8*this._,r=8*this.O.nSigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=Math.floor(t/4294967296),n[15+(r+64>>>9<<4)]=t,this.O.nSigBytes=4*n.length,this.I(),this.h},t.prototype.clone=function(){return new t({hash:this.h,blockSize:this.U,data:this.O,nBytes:this._})},t.hash=function(n,r){return new t(r).finalize(n)},t}(e.P)},3354:function(n,t,r){r.d(t,{e:function(){return o}});var i=r(5720),e=r(9054),o=function(){function n(t,r){if(Array.isArray(t)||!t)return this.N=Array.isArray(t)?t:[],void(this.S="number"==typeof r?r:4*this.N.length);if(t instanceof n)return this.N=t.words.slice(),void(this.S=t.nSigBytes);var i;try{t instanceof ArrayBuffer?i=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!i)throw new Error("Invalid argument");for(var e=i.byteLength,o=[],u=0;u<e;u++)o[u>>>2]|=i[u]<<24-u%4*8;this.N=o,this.S=e}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.S},set:function(n){this.S=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.N},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):i.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.N,t=this.S,r=new Uint8Array(t),i=0;i<t;i++)r[i]=n[i>>>2]>>>24-i%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.S%4)for(var i=0;i<r;i++){var e=t[i>>>2]>>>24-i%4*8&255;this.N[this.S+i>>>2]|=e<<24-(this.S+i)%4*8}else for(i=0;i<r;i+=4)this.N[this.S+i>>>2]=t[i>>>2];return this.S+=r,this},n.prototype.clamp=function(){var n=this.S;this.N[n>>>2]&=4294967295<<32-n%4*8,this.N.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.N.slice(),this.S)},n.random=function(t){for(var r=[],i=0;i<t;i+=4)r.push((0,e.M)());return new n(r,t)},n}()},7211:function(n,t,r){r.d(t,{C:function(){return o}});var i=r(3354),e=r(4768),o=function(){function n(n){this.F=0,this.U=0,this.v=n,this.O=n&&void 0!==n.data?n.data.clone():new i.e,this._=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.U},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.O=void 0!==n?n.clone():new i.e,this._="number"==typeof t?t:0},n.prototype.B=function(n){var t="string"==typeof n?e.d.parse(n):n;this.O.concat(t),this._+=t.nSigBytes},n.prototype.I=function(n){var t,r=this.O.words,e=this.O.nSigBytes,o=this.U,u=e/(4*this.U),f=(u=n?Math.ceil(u):Math.max((0|u)-this.F,0))*o,c=Math.min(4*f,e);if(f){for(var s=0;s<f;s+=o)this.j(r,s);t=r.splice(0,f),this.O.nSigBytes-=c}return new i.e(t,c)},n.prototype.j=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,r){r.d(t,{P:function(){return u}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.U=16,r.v=t,t&&"number"==typeof t.blockSize&&(r.U=t.blockSize),r.reset(t?t.data:void 0,t?t.nBytes:void 0),r}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.U},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.l()},t.prototype.update=function(n){return this.B(n),this.I(),this},t.prototype.finalize=function(n){return n&&this.B(n),this.A()},t.prototype.l=function(){throw new Error("Not implemented")},t.prototype.A=function(){throw new Error("Not implemented")},t}(e.C)},1756:function(n,t,r){r.d(t,{w:function(){return u}});var i,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(i=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(i)?(i=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(i)&&i):i);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},5720:function(n,t,r){r.d(t,{p:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],e=0;e<t;e+=2)r[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new i.e(r,t/2)}}},8702:function(n,t,r){r.d(t,{m:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(n){for(var t=n.length,r=[],e=0;e<t;e++)r[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new i.e(r,t)}}},4768:function(n,t,r){r.d(t,{d:function(){return e}});var i=r(8702),e={stringify:function(n){try{return decodeURIComponent(escape(i.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return i.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,r){r.d(t,{M:function(){return e}});var i=r(1756);var e=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,i.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function r(i){var e=t[i];if(void 0!==e)return e.exports;var o=t[i]={exports:{}};return n[i](o,o.exports,r),o.exports}r.d=function(n,t){for(var i in t)r.o(t,i)&&!r.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"H",{value:!0})};var i={};return function(){r.r(i),r.d(i,{PBKDF2:function(){return c}});var n,t=r(5561),e=r(6367),o=r(3354),u=function(){function n(n){this.v=n}return n.prototype.compute=function(n,t){throw new Error("Not implemented")},n.getKey=function(n,t,r){throw new Error("Not implemented")},n}(),f=(n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(t,r)},function(t,r){function i(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}),c=function(n){function r(r){var i=n.call(this,r)||this;return i.k=4,i.T=t.SHA256,i.R=1e4,r&&(i.k=void 0!==r.keySize?r.keySize:i.k,i.T=void 0!==r.Hasher?r.Hasher:i.T,i.R=void 0!==r.iterations?r.iterations:i.R),i}return f(r,n),r.prototype.compute=function(n,t){for(var r=new e.Hmac(new this.T,n),i=new o.e,u=new o.e([1]),f=i.words,c=u.words,s=this.k,a=this.R;f.length<s;){var h=r.update(t).finalize(u);r.reset();for(var v=h.words,w=v.length,d=h,l=1;l<a;l++){d=r.finalize(d),r.reset();for(var y=d.words,b=0;b<w;b++)v[b]^=y[b]}i.concat(h),c[0]++}return i.nSigBytes=4*s,i},r.getKey=function(n,t,i){return new r(i).compute(n,t)},r}(u)}(),i}()}));
\ No newline at end of file
... ...
  1 +import { PropsWithKey } from "./lib/algorithm/cipher/Cipher";
  2 +import type { Word32Array } from "./lib/Word32Array";
  3 +import { StreamCipher, StreamCipherProps } from "./lib/algorithm/cipher/StreamCipher";
  4 +import { CipherParams } from "./lib/algorithm/cipher/CipherParams";
  5 +export interface RC4Props extends StreamCipherProps {
  6 +}
  7 +export declare class RC4 extends StreamCipher {
  8 + static readonly ivSize = 0;
  9 + static readonly keySize: number;
  10 + protected _props: PropsWithKey<RC4Props>;
  11 + protected S: number[];
  12 + protected i: number;
  13 + protected j: number;
  14 + constructor(props: PropsWithKey<RC4Props>);
  15 + protected _doReset(): void;
  16 + protected _doProcessBlock(words: number[], offset: number): void;
  17 + protected generateKeyStreamWord(): number;
  18 + /**
  19 + * Creates this cipher in encryption mode.
  20 + *
  21 + * @param {Word32Array} key The key.
  22 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  23 + * @return {Cipher} A cipher instance.
  24 + * @example
  25 + * var cipher = RC4.createEncryptor(keyWordArray);
  26 + */
  27 + static createEncryptor(key: Word32Array, props?: Partial<StreamCipherProps>): RC4;
  28 + /**
  29 + * Creates this cipher in decryption mode.
  30 + *
  31 + * @param {Word32Array} key The key.
  32 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  33 + * @return {Cipher} A cipher instance.
  34 + * @example
  35 + * var cipher = RC4.createDecryptor(keyWordArray, { iv: ivWordArray });
  36 + */
  37 + static createDecryptor(key: Word32Array, props?: Partial<StreamCipherProps>): RC4;
  38 + /**
  39 + * Encrypt a message with key
  40 + *
  41 + * @param {Word32Array|string} message
  42 + * @param {Word32Array|string} key
  43 + * @param {Partial<AESProps>?} props
  44 + * @example
  45 + * var encryptedMessage = RC4.encrypt("test", "pass");
  46 + */
  47 + static encrypt(message: Word32Array | string, key: Word32Array | string, props?: Partial<RC4Props>): CipherParams;
  48 + /**
  49 + * Encrypt a encrypted message with key
  50 + *
  51 + * @param {CipherParams} cipherText
  52 + * @param {Word32Array|string} key
  53 + * @param {Partial<AESProps>?} props
  54 + * @example
  55 + * var encryptedMessage = RC4.decrypt(cipherProps, "pass");
  56 + */
  57 + static decrypt(cipherText: CipherParams, key: Word32Array | string, props?: Partial<RC4Props>): Word32Array;
  58 +}
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var i in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[i]=r[i]}}(this,(function(){return function(){"use strict";var n={6367:function(n,t,r){r.d(t,{Hmac:function(){return e}});var i=r(4768),e=function(){function n(n,t){this.u=n,"string"==typeof t&&(t=i.d.parse(t));var r=n.blockSize,e=4*r;t.nSigBytes>e&&(t=n.finalize(t)),t.clamp();for(var o=this.h=t.clone(),u=this.v=t.clone(),f=o.words,c=u.words,a=0;a<r;a++)f[a]^=1549556828,c[a]^=909522486;u.nSigBytes=e,o.nSigBytes=e,this.reset()}return n.prototype.reset=function(){this.u.reset(),this.u.update(this.v)},n.prototype.update=function(n){return this.u.update(n),this},n.prototype.finalize=function(n){var t=this.u.finalize(n);return this.u.reset(),this.u.finalize(this.h.clone().concat(t))},n}()},5561:function(n,t,r){r.d(t,{SHA256:function(){return v}});var i,e=r(1868),o=r(3354),u=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),f=[],c=[];function a(n){for(var t=Math.sqrt(n),r=2;r<=t;r++)if(!(n%r))return!1;return!0}function s(n){return 4294967296*(n-(0|n))|0}!function(){for(var n=2,t=0;t<64;)a(n)&&(t<8&&(f[t]=s(Math.pow(n,.5))),c[t]=s(Math.pow(n,1/3)),t++),n++}();var h=[],v=function(n){function t(t){var r=n.call(this,t)||this;return r.l=new o.e(f.slice(0)),r.O=t,t&&void 0!==t.hash&&(r.l=t.hash.clone()),r}return u(t,n),t.prototype.A=function(){this.l=new o.e(f.slice(0))},t.prototype.I=function(n,t){for(var r=this.l.words,i=r[0],e=r[1],o=r[2],u=r[3],f=r[4],a=r[5],s=r[6],v=r[7],w=0;w<64;w++){if(w<16)h[w]=0|n[t+w];else{var d=h[w-15],l=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,y=h[w-2],b=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;h[w]=l+h[w-7]+b+h[w-16]}var p=i&e^i&o^e&o,m=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),j=v+((f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25))+(f&a^~f&s)+c[w]+h[w];v=s,s=a,a=f,f=u+j|0,u=o,o=e,e=i,i=j+(m+p)|0}r[0]=r[0]+i|0,r[1]=r[1]+e|0,r[2]=r[2]+o|0,r[3]=r[3]+u|0,r[4]=r[4]+f|0,r[5]=r[5]+a|0,r[6]=r[6]+s|0,r[7]=r[7]+v|0},t.prototype.k=function(){var n=this.N.words,t=8*this.U,r=8*this.N.nSigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=Math.floor(t/4294967296),n[15+(r+64>>>9<<4)]=t,this.N.nSigBytes=4*n.length,this.F(),this.l},t.prototype.clone=function(){return new t({hash:this.l,blockSize:this.H,data:this.N,nBytes:this.U})},t.hash=function(n,r){return new t(r).finalize(n)},t}(e.P)},3354:function(n,t,r){r.d(t,{e:function(){return o}});var i=r(5720),e=r(9054),o=function(){function n(t,r){if(Array.isArray(t)||!t)return this.T=Array.isArray(t)?t:[],void(this.B="number"==typeof r?r:4*this.T.length);if(t instanceof n)return this.T=t.words.slice(),void(this.B=t.nSigBytes);var i;try{t instanceof ArrayBuffer?i=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!i)throw new Error("Invalid argument");for(var e=i.byteLength,o=[],u=0;u<e;u++)o[u>>>2]|=i[u]<<24-u%4*8;this.T=o,this.B=e}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.B},set:function(n){this.B=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.T},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):i.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.T,t=this.B,r=new Uint8Array(t),i=0;i<t;i++)r[i]=n[i>>>2]>>>24-i%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.B%4)for(var i=0;i<r;i++){var e=t[i>>>2]>>>24-i%4*8&255;this.T[this.B+i>>>2]|=e<<24-(this.B+i)%4*8}else for(i=0;i<r;i+=4)this.T[this.B+i>>>2]=t[i>>>2];return this.B+=r,this},n.prototype.clamp=function(){var n=this.B;this.T[n>>>2]&=4294967295<<32-n%4*8,this.T.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.T.slice(),this.B)},n.random=function(t){for(var r=[],i=0;i<t;i+=4)r.push((0,e.M)());return new n(r,t)},n}()},7211:function(n,t,r){r.d(t,{C:function(){return o}});var i=r(3354),e=r(4768),o=function(){function n(n){this.R=0,this.H=0,this.O=n,this.N=n&&void 0!==n.data?n.data.clone():new i.e,this.U=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.H},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.N=void 0!==n?n.clone():new i.e,this.U="number"==typeof t?t:0},n.prototype.G=function(n){var t="string"==typeof n?e.d.parse(n):n;this.N.concat(t),this.U+=t.nSigBytes},n.prototype.F=function(n){var t,r=this.N.words,e=this.N.nSigBytes,o=this.H,u=e/(4*this.H),f=(u=n?Math.ceil(u):Math.max((0|u)-this.R,0))*o,c=Math.min(4*f,e);if(f){for(var a=0;a<f;a+=o)this.I(r,a);t=r.splice(0,f),this.N.nSigBytes-=c}return new i.e(t,c)},n.prototype.I=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,r){r.d(t,{P:function(){return u}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.H=16,r.O=t,t&&"number"==typeof t.blockSize&&(r.H=t.blockSize),r.reset(t?t.data:void 0,t?t.nBytes:void 0),r}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.H},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.A()},t.prototype.update=function(n){return this.G(n),this.F(),this},t.prototype.finalize=function(n){return n&&this.G(n),this.k()},t.prototype.A=function(){throw new Error("Not implemented")},t.prototype.k=function(){throw new Error("Not implemented")},t}(e.C)},9456:function(n,t,r){r.d(t,{t:function(){return f}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(){return(u=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},f=function(n){function t(t){var r=n.call(this,t)||this;return r.J=1,r.O=t,r.K=t.key,r.L=void 0!==t.iv?t.iv:r.L,r.J=void 0!==t.transformMode?t.transformMode:r.J,r}return o(t,n),Object.defineProperty(t.prototype,"iv",{get:function(){return this.L},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.A()},t.prototype.process=function(n){return this.G(n),this.F()},t.prototype.finalize=function(n){return n&&this.G(n),this.k()},t.prototype.A=function(){throw new Error("Not implemented")},t.prototype.I=function(n,t){throw new Error("Not implemented")},t.prototype.k=function(){throw new Error("Not implemented")},t.createEncryptor=function(n,r){return new t(u(u({},r=void 0===r?{}:r),{key:n,transformMode:t.ENC_TRANSFORM_MODE}))},t.createDecryptor=function(n,r){return new t(u(u({},r=void 0===r?{}:r),{key:n,transformMode:t.DEC_TRANSFORM_MODE}))},t.ENC_TRANSFORM_MODE=1,t.DEC_TRANSFORM_MODE=2,t.keySize=4,t.ivSize=4,t}(e.C)},2505:function(n,t,r){r.d(t,{Q:function(){return e}});var i=r(1232),e=function(){function n(n){this.formatter=i.w,n&&(this.cipherText=n.cipherText,this.key=n.key,this.iv=n.iv,this.salt=n.salt,this.Algorithm=n.Algorithm,this.mode=n.mode,this.padding=n.padding,this.blockSize=n.blockSize,this.formatter=n.formatter||i.w)}return n.prototype.toString=function(n){return(n||this.formatter).stringify(this)},n}()},5693:function(n,t,r){r.d(t,{E:function(){return c}});var i=r(9109),e=r(2214),o=r(2505),u=r(1232),f=function(){return(f=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},c={encrypt:function(n,t,r,u){var c=u?f({},u):{},a=u&&u.KDF?u.KDF:e.s,s={};u&&u.kdfHasher&&(s.kdfHasher=u.kdfHasher),u&&u.kdfIterations&&(s.kdfIterations=u.kdfIterations),u&&u.kdfModule&&(s.kdfModule=u.kdfModule);var h=a.execute(r,n.keySize,n.ivSize,c.kdfSalt,s);c.iv=h.iv;var v=i.D.encrypt(n,t,h.key,c);return new o.Q(f(f({},v),{key:h.key,iv:h.iv,salt:h.salt}))},decrypt:function(n,t,r,o){var c=o?f({},o):{},a=c.KDF?c.KDF:e.s,s=c.formatter?c.formatter:u.w,h=(0,i.W)(t,s),v={};o&&o.kdfHasher&&(v.kdfHasher=o.kdfHasher),o&&o.kdfIterations&&(v.kdfIterations=o.kdfIterations),o&&o.kdfModule&&(v.kdfModule=o.kdfModule);var w=a.execute(r,n.keySize,n.ivSize,h.salt,v);return c.iv=w.iv,i.D.decrypt(n,h,w.key,c)}}},9109:function(n,t,r){r.d(t,{W:function(){return o},D:function(){return u}});var i=r(1232),e=r(2505);function o(n,t){return"string"==typeof n?t.parse(n):n}var u={encrypt:function(n,t,r,o){var u=n.createEncryptor(r,o),f=u.finalize(t);return new e.Q({cipherText:f,key:r,iv:u.iv,Algorithm:n,mode:u.mode,padding:u.padding,blockSize:u.blockSize,formatter:(null==o?void 0:o.formatter)||i.w})},decrypt:function(n,t,r,e){var u=n.createDecryptor(r,e),f=o(t,(null==e?void 0:e.formatter)||i.w);return u.finalize(f.cipherText||"")}}},30:function(n,t,r){r.d(t,{q:function(){return u}});var i,e=r(9456),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.H=1,r}return o(t,n),t.prototype.k=function(){return this.F(!0)},t}(e.t)},1232:function(n,t,r){r.d(t,{w:function(){return u}});var i=r(2505),e=r(3354),o=r(1773),u={stringify:function(n){var t=n.cipherText,r=n.salt;return t?r?new e.e([1398893684,1701076831]).concat(r).concat(t).toString(o.D):t.toString(o.D):""},parse:function(n){var t,r=o.D.parse(n),u=r.words;return 1398893684===u[0]&&1701076831===u[1]&&(t=new e.e(u.slice(2,4)),u.splice(0,4),r.nSigBytes-=16),new i.Q({cipherText:r,salt:t})}}},2214:function(n,t,r){r.d(t,{s:function(){return f}});var i=r(3354),e=r(2505),o=r(7008),u=function(){return(u=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},f={execute:function(n,t,r,f,c){f||(f=i.e.random(8));var a=c&&c.kdfModule||o.E,s=c?{Hasher:c.kdfHasher,iterations:c.kdfIterations}:{},h=a.getKey(n,f,u(u({},s),{keySize:t+r})),v=new i.e(h.words.slice(t),4*r);return h.nSigBytes=4*t,new e.Q({key:h,iv:v,salt:f})}}},7008:function(n,t,r){r.d(t,{E:function(){return a}});var i,e=r(5561),o=r(6367),u=r(3354),f=r(9541),c=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),a=function(n){function t(t){var r=n.call(this,t)||this;return r.V=4,r.X=e.SHA256,r.Y=1e4,t&&(r.V=void 0!==t.keySize?t.keySize:r.V,r.X=void 0!==t.Hasher?t.Hasher:r.X,r.Y=void 0!==t.iterations?t.iterations:r.Y),r}return c(t,n),t.prototype.compute=function(n,t){for(var r=new o.Hmac(new this.X,n),i=new u.e,e=new u.e([1]),f=i.words,c=e.words,a=this.V,s=this.Y;f.length<a;){var h=r.update(t).finalize(e);r.reset();for(var v=h.words,w=v.length,d=h,l=1;l<s;l++){d=r.finalize(d),r.reset();for(var y=d.words,b=0;b<w;b++)v[b]^=y[b]}i.concat(h),c[0]++}return i.nSigBytes=4*a,i},t.getKey=function(n,r,i){return new t(i).compute(n,r)},t}(f._)},9541:function(n,t,r){r.d(t,{_:function(){return i}});var i=function(){function n(n){this.O=n}return n.prototype.compute=function(n,t){throw new Error("Not implemented")},n.getKey=function(n,t,r){throw new Error("Not implemented")},n}()},1756:function(n,t,r){r.d(t,{w:function(){return u}});var i,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(i=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(i)?(i=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(i)&&i):i);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},1773:function(n,t,r){r.d(t,{D:function(){return f}});for(var i=r(3354),e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=[],u=0;u<e.length;u++)o[e.charCodeAt(u)]=u;var f={stringify:function(n){var t=n.words,r=n.nSigBytes;n.clamp();for(var i=[],o=0;o<r;o+=3)for(var u=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,f=0;f<4&&o+.75*f<r;f++)i.push(e.charAt(u>>>6*(3-f)&63));var c=e.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(n){var t=n.length,r=e.charAt(64);if(r){var u=n.indexOf(r);-1!==u&&(t=u)}for(var f=[],c=0,a=0;a<t;a++)if(a%4){var s=o[n.charCodeAt(a-1)]<<a%4*2|o[n.charCodeAt(a)]>>>6-a%4*2;f[c>>>2]|=s<<24-c%4*8,c++}return new i.e(f,c)}}},5720:function(n,t,r){r.d(t,{p:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],e=0;e<t;e+=2)r[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new i.e(r,t/2)}}},8702:function(n,t,r){r.d(t,{m:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(n){for(var t=n.length,r=[],e=0;e<t;e++)r[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new i.e(r,t)}}},4768:function(n,t,r){r.d(t,{d:function(){return e}});var i=r(8702),e={stringify:function(n){try{return decodeURIComponent(escape(i.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return i.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,r){r.d(t,{M:function(){return e}});var i=r(1756);var e=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,i.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function r(i){var e=t[i];if(void 0!==e)return e.exports;var o=t[i]={exports:{}};return n[i](o,o.exports,r),o.exports}r.d=function(n,t){for(var i in t)r.o(t,i)&&!r.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"Z",{value:!0})};var i={};return function(){r.r(i),r.d(i,{RC4:function(){return c}});var n,t=r(30),e=r(5693),o=r(9109),u=(n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(t,r)},function(t,r){function i(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}),f=function(){return(f=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},c=function(n){function t(t){var r=n.call(this,t)||this;return r.S=[],r.i=0,r.j=0,r.O=t,r.A(),r}return u(t,n),t.prototype.A=function(){var n=this.K,t=n.words,r=n.nSigBytes;this.S=[];for(var i=0;i<256;i++)this.S[i]=i;i=0;for(var e=0;i<256;i++){var o=i%r,u=t[o>>>2]>>>24-o%4*8&255;e=(e+this.S[i]+u)%256;var f=this.S[i];this.S[i]=this.S[e],this.S[e]=f}this.i=this.j=0},t.prototype.I=function(n,t){n[t]^=this.generateKeyStreamWord()},t.prototype.generateKeyStreamWord=function(){for(var n=this.S,t=this.i,r=this.j,i=0,e=0;e<4;e++){r=(r+n[t=(t+1)%256])%256;var o=n[t];n[t]=n[r],n[r]=o,i|=n[(n[t]+n[r])%256]<<24-8*e}return this.i=t,this.j=r,i},t.createEncryptor=function(n,r){return new t(f(f({},r=void 0===r?{}:r),{key:n}))},t.createDecryptor=function(n,r){return new t(f(f({},r=void 0===r?{}:r),{key:n}))},t.encrypt=function(n,r,i){return"string"==typeof r?e.E.encrypt(t,n,r,i):o.D.encrypt(t,n,r,i)},t.decrypt=function(n,r,i){return"string"==typeof r?e.E.decrypt(t,n,r,i):o.D.decrypt(t,n,r,i)},t.ivSize=0,t.keySize=8,t}(t.q)}(),i}()}));
\ No newline at end of file
... ...
  1 +import { CipherProps, PropsWithKey } from "./lib/algorithm/cipher/Cipher";
  2 +import type { Word32Array } from "./lib/Word32Array";
  3 +import { CipherParams } from "./lib/algorithm/cipher/CipherParams";
  4 +import { RC4 } from "./RC4";
  5 +export interface RC4DropProps extends CipherProps {
  6 + drop?: number;
  7 +}
  8 +export declare class RC4Drop extends RC4 {
  9 + protected drop: number;
  10 + constructor(props: PropsWithKey<RC4DropProps>);
  11 + protected _doReset(): void;
  12 + /**
  13 + * Creates this cipher in encryption mode.
  14 + *
  15 + * @param {Word32Array} key The key.
  16 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  17 + * @return {Cipher} A cipher instance.
  18 + * @example
  19 + * var cipher = RC4Drop.createEncryptor(keyWordArray);
  20 + */
  21 + static createEncryptor(key: Word32Array, props?: Partial<CipherProps>): RC4Drop;
  22 + /**
  23 + * Creates this cipher in decryption mode.
  24 + *
  25 + * @param {Word32Array} key The key.
  26 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  27 + * @return {Cipher} A cipher instance.
  28 + * @example
  29 + * var cipher = RC4Drop.createDecryptor(keyWordArray, { iv: ivWordArray });
  30 + */
  31 + static createDecryptor(key: Word32Array, props?: Partial<CipherProps>): RC4Drop;
  32 + /**
  33 + * Encrypt a message with key
  34 + *
  35 + * @param {Word32Array|string} message
  36 + * @param {Word32Array|string} key
  37 + * @param {Partial<AESProps>?} props
  38 + * @example
  39 + * var encryptedMessage = RC4Drop.encrypt("test", "pass");
  40 + */
  41 + static encrypt(message: Word32Array | string, key: Word32Array | string, props?: Partial<RC4DropProps>): CipherParams;
  42 + /**
  43 + * Encrypt a encrypted message with key
  44 + *
  45 + * @param {CipherParams} cipherText
  46 + * @param {Word32Array|string} key
  47 + * @param {Partial<AESProps>?} props
  48 + * @example
  49 + * var encryptedMessage = RC4Drop.decrypt(cipherProps, "pass");
  50 + */
  51 + static decrypt(cipherText: CipherParams, key: Word32Array | string, props?: Partial<RC4DropProps>): Word32Array;
  52 +}
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var i in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[i]=r[i]}}(this,(function(){return function(){"use strict";var n={6367:function(n,t,r){r.d(t,{Hmac:function(){return e}});var i=r(4768),e=function(){function n(n,t){this.u=n,"string"==typeof t&&(t=i.d.parse(t));var r=n.blockSize,e=4*r;t.nSigBytes>e&&(t=n.finalize(t)),t.clamp();for(var o=this.h=t.clone(),u=this.v=t.clone(),f=o.words,c=u.words,a=0;a<r;a++)f[a]^=1549556828,c[a]^=909522486;u.nSigBytes=e,o.nSigBytes=e,this.reset()}return n.prototype.reset=function(){this.u.reset(),this.u.update(this.v)},n.prototype.update=function(n){return this.u.update(n),this},n.prototype.finalize=function(n){var t=this.u.finalize(n);return this.u.reset(),this.u.finalize(this.h.clone().concat(t))},n}()},4615:function(n,t,r){r.d(t,{RC4:function(){return a}});var i,e=r(30),o=r(5693),u=r(9109),f=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),c=function(){return(c=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},a=function(n){function t(t){var r=n.call(this,t)||this;return r.S=[],r.i=0,r.j=0,r.l=t,r.O(),r}return f(t,n),t.prototype.O=function(){var n=this.A,t=n.words,r=n.nSigBytes;this.S=[];for(var i=0;i<256;i++)this.S[i]=i;i=0;for(var e=0;i<256;i++){var o=i%r,u=t[o>>>2]>>>24-o%4*8&255;e=(e+this.S[i]+u)%256;var f=this.S[i];this.S[i]=this.S[e],this.S[e]=f}this.i=this.j=0},t.prototype.k=function(n,t){n[t]^=this.generateKeyStreamWord()},t.prototype.generateKeyStreamWord=function(){for(var n=this.S,t=this.i,r=this.j,i=0,e=0;e<4;e++){r=(r+n[t=(t+1)%256])%256;var o=n[t];n[t]=n[r],n[r]=o,i|=n[(n[t]+n[r])%256]<<24-8*e}return this.i=t,this.j=r,i},t.createEncryptor=function(n,r){return new t(c(c({},r=void 0===r?{}:r),{key:n}))},t.createDecryptor=function(n,r){return new t(c(c({},r=void 0===r?{}:r),{key:n}))},t.encrypt=function(n,r,i){return"string"==typeof r?o.E.encrypt(t,n,r,i):u.D.encrypt(t,n,r,i)},t.decrypt=function(n,r,i){return"string"==typeof r?o.E.decrypt(t,n,r,i):u.D.decrypt(t,n,r,i)},t.ivSize=0,t.keySize=8,t}(e.q)},5561:function(n,t,r){r.d(t,{SHA256:function(){return v}});var i,e=r(1868),o=r(3354),u=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),f=[],c=[];function a(n){for(var t=Math.sqrt(n),r=2;r<=t;r++)if(!(n%r))return!1;return!0}function s(n){return 4294967296*(n-(0|n))|0}!function(){for(var n=2,t=0;t<64;)a(n)&&(t<8&&(f[t]=s(Math.pow(n,.5))),c[t]=s(Math.pow(n,1/3)),t++),n++}();var h=[],v=function(n){function t(t){var r=n.call(this,t)||this;return r.I=new o.e(f.slice(0)),r.l=t,t&&void 0!==t.hash&&(r.I=t.hash.clone()),r}return u(t,n),t.prototype.O=function(){this.I=new o.e(f.slice(0))},t.prototype.k=function(n,t){for(var r=this.I.words,i=r[0],e=r[1],o=r[2],u=r[3],f=r[4],a=r[5],s=r[6],v=r[7],w=0;w<64;w++){if(w<16)h[w]=0|n[t+w];else{var d=h[w-15],l=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,y=h[w-2],b=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;h[w]=l+h[w-7]+b+h[w-16]}var p=i&e^i&o^e&o,m=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),j=v+((f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25))+(f&a^~f&s)+c[w]+h[w];v=s,s=a,a=f,f=u+j|0,u=o,o=e,e=i,i=j+(m+p)|0}r[0]=r[0]+i|0,r[1]=r[1]+e|0,r[2]=r[2]+o|0,r[3]=r[3]+u|0,r[4]=r[4]+f|0,r[5]=r[5]+a|0,r[6]=r[6]+s|0,r[7]=r[7]+v|0},t.prototype.N=function(){var n=this.U.words,t=8*this.F,r=8*this.U.nSigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=Math.floor(t/4294967296),n[15+(r+64>>>9<<4)]=t,this.U.nSigBytes=4*n.length,this.H(),this.I},t.prototype.clone=function(){return new t({hash:this.I,blockSize:this.T,data:this.U,nBytes:this.F})},t.hash=function(n,r){return new t(r).finalize(n)},t}(e.P)},3354:function(n,t,r){r.d(t,{e:function(){return o}});var i=r(5720),e=r(9054),o=function(){function n(t,r){if(Array.isArray(t)||!t)return this.R=Array.isArray(t)?t:[],void(this.B="number"==typeof r?r:4*this.R.length);if(t instanceof n)return this.R=t.words.slice(),void(this.B=t.nSigBytes);var i;try{t instanceof ArrayBuffer?i=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!i)throw new Error("Invalid argument");for(var e=i.byteLength,o=[],u=0;u<e;u++)o[u>>>2]|=i[u]<<24-u%4*8;this.R=o,this.B=e}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.B},set:function(n){this.B=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.R},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):i.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.R,t=this.B,r=new Uint8Array(t),i=0;i<t;i++)r[i]=n[i>>>2]>>>24-i%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.B%4)for(var i=0;i<r;i++){var e=t[i>>>2]>>>24-i%4*8&255;this.R[this.B+i>>>2]|=e<<24-(this.B+i)%4*8}else for(i=0;i<r;i+=4)this.R[this.B+i>>>2]=t[i>>>2];return this.B+=r,this},n.prototype.clamp=function(){var n=this.B;this.R[n>>>2]&=4294967295<<32-n%4*8,this.R.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.R.slice(),this.B)},n.random=function(t){for(var r=[],i=0;i<t;i+=4)r.push((0,e.M)());return new n(r,t)},n}()},7211:function(n,t,r){r.d(t,{C:function(){return o}});var i=r(3354),e=r(4768),o=function(){function n(n){this.G=0,this.T=0,this.l=n,this.U=n&&void 0!==n.data?n.data.clone():new i.e,this.F=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.T},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.U=void 0!==n?n.clone():new i.e,this.F="number"==typeof t?t:0},n.prototype.J=function(n){var t="string"==typeof n?e.d.parse(n):n;this.U.concat(t),this.F+=t.nSigBytes},n.prototype.H=function(n){var t,r=this.U.words,e=this.U.nSigBytes,o=this.T,u=e/(4*this.T),f=(u=n?Math.ceil(u):Math.max((0|u)-this.G,0))*o,c=Math.min(4*f,e);if(f){for(var a=0;a<f;a+=o)this.k(r,a);t=r.splice(0,f),this.U.nSigBytes-=c}return new i.e(t,c)},n.prototype.k=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,r){r.d(t,{P:function(){return u}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.T=16,r.l=t,t&&"number"==typeof t.blockSize&&(r.T=t.blockSize),r.reset(t?t.data:void 0,t?t.nBytes:void 0),r}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.T},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.O()},t.prototype.update=function(n){return this.J(n),this.H(),this},t.prototype.finalize=function(n){return n&&this.J(n),this.N()},t.prototype.O=function(){throw new Error("Not implemented")},t.prototype.N=function(){throw new Error("Not implemented")},t}(e.C)},9456:function(n,t,r){r.d(t,{t:function(){return f}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(){return(u=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},f=function(n){function t(t){var r=n.call(this,t)||this;return r.K=1,r.l=t,r.A=t.key,r.L=void 0!==t.iv?t.iv:r.L,r.K=void 0!==t.transformMode?t.transformMode:r.K,r}return o(t,n),Object.defineProperty(t.prototype,"iv",{get:function(){return this.L},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.O()},t.prototype.process=function(n){return this.J(n),this.H()},t.prototype.finalize=function(n){return n&&this.J(n),this.N()},t.prototype.O=function(){throw new Error("Not implemented")},t.prototype.k=function(n,t){throw new Error("Not implemented")},t.prototype.N=function(){throw new Error("Not implemented")},t.createEncryptor=function(n,r){return new t(u(u({},r=void 0===r?{}:r),{key:n,transformMode:t.ENC_TRANSFORM_MODE}))},t.createDecryptor=function(n,r){return new t(u(u({},r=void 0===r?{}:r),{key:n,transformMode:t.DEC_TRANSFORM_MODE}))},t.ENC_TRANSFORM_MODE=1,t.DEC_TRANSFORM_MODE=2,t.keySize=4,t.ivSize=4,t}(e.C)},2505:function(n,t,r){r.d(t,{Q:function(){return e}});var i=r(1232),e=function(){function n(n){this.formatter=i.w,n&&(this.cipherText=n.cipherText,this.key=n.key,this.iv=n.iv,this.salt=n.salt,this.Algorithm=n.Algorithm,this.mode=n.mode,this.padding=n.padding,this.blockSize=n.blockSize,this.formatter=n.formatter||i.w)}return n.prototype.toString=function(n){return(n||this.formatter).stringify(this)},n}()},5693:function(n,t,r){r.d(t,{E:function(){return c}});var i=r(9109),e=r(2214),o=r(2505),u=r(1232),f=function(){return(f=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},c={encrypt:function(n,t,r,u){var c=u?f({},u):{},a=u&&u.KDF?u.KDF:e.s,s={};u&&u.kdfHasher&&(s.kdfHasher=u.kdfHasher),u&&u.kdfIterations&&(s.kdfIterations=u.kdfIterations),u&&u.kdfModule&&(s.kdfModule=u.kdfModule);var h=a.execute(r,n.keySize,n.ivSize,c.kdfSalt,s);c.iv=h.iv;var v=i.D.encrypt(n,t,h.key,c);return new o.Q(f(f({},v),{key:h.key,iv:h.iv,salt:h.salt}))},decrypt:function(n,t,r,o){var c=o?f({},o):{},a=c.KDF?c.KDF:e.s,s=c.formatter?c.formatter:u.w,h=(0,i.W)(t,s),v={};o&&o.kdfHasher&&(v.kdfHasher=o.kdfHasher),o&&o.kdfIterations&&(v.kdfIterations=o.kdfIterations),o&&o.kdfModule&&(v.kdfModule=o.kdfModule);var w=a.execute(r,n.keySize,n.ivSize,h.salt,v);return c.iv=w.iv,i.D.decrypt(n,h,w.key,c)}}},9109:function(n,t,r){r.d(t,{W:function(){return o},D:function(){return u}});var i=r(1232),e=r(2505);function o(n,t){return"string"==typeof n?t.parse(n):n}var u={encrypt:function(n,t,r,o){var u=n.createEncryptor(r,o),f=u.finalize(t);return new e.Q({cipherText:f,key:r,iv:u.iv,Algorithm:n,mode:u.mode,padding:u.padding,blockSize:u.blockSize,formatter:(null==o?void 0:o.formatter)||i.w})},decrypt:function(n,t,r,e){var u=n.createDecryptor(r,e),f=o(t,(null==e?void 0:e.formatter)||i.w);return u.finalize(f.cipherText||"")}}},30:function(n,t,r){r.d(t,{q:function(){return u}});var i,e=r(9456),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.T=1,r}return o(t,n),t.prototype.N=function(){return this.H(!0)},t}(e.t)},1232:function(n,t,r){r.d(t,{w:function(){return u}});var i=r(2505),e=r(3354),o=r(1773),u={stringify:function(n){var t=n.cipherText,r=n.salt;return t?r?new e.e([1398893684,1701076831]).concat(r).concat(t).toString(o.D):t.toString(o.D):""},parse:function(n){var t,r=o.D.parse(n),u=r.words;return 1398893684===u[0]&&1701076831===u[1]&&(t=new e.e(u.slice(2,4)),u.splice(0,4),r.nSigBytes-=16),new i.Q({cipherText:r,salt:t})}}},2214:function(n,t,r){r.d(t,{s:function(){return f}});var i=r(3354),e=r(2505),o=r(7008),u=function(){return(u=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},f={execute:function(n,t,r,f,c){f||(f=i.e.random(8));var a=c&&c.kdfModule||o.E,s=c?{Hasher:c.kdfHasher,iterations:c.kdfIterations}:{},h=a.getKey(n,f,u(u({},s),{keySize:t+r})),v=new i.e(h.words.slice(t),4*r);return h.nSigBytes=4*t,new e.Q({key:h,iv:v,salt:f})}}},7008:function(n,t,r){r.d(t,{E:function(){return a}});var i,e=r(5561),o=r(6367),u=r(3354),f=r(9541),c=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),a=function(n){function t(t){var r=n.call(this,t)||this;return r.V=4,r.X=e.SHA256,r.Y=1e4,t&&(r.V=void 0!==t.keySize?t.keySize:r.V,r.X=void 0!==t.Hasher?t.Hasher:r.X,r.Y=void 0!==t.iterations?t.iterations:r.Y),r}return c(t,n),t.prototype.compute=function(n,t){for(var r=new o.Hmac(new this.X,n),i=new u.e,e=new u.e([1]),f=i.words,c=e.words,a=this.V,s=this.Y;f.length<a;){var h=r.update(t).finalize(e);r.reset();for(var v=h.words,w=v.length,d=h,l=1;l<s;l++){d=r.finalize(d),r.reset();for(var y=d.words,b=0;b<w;b++)v[b]^=y[b]}i.concat(h),c[0]++}return i.nSigBytes=4*a,i},t.getKey=function(n,r,i){return new t(i).compute(n,r)},t}(f._)},9541:function(n,t,r){r.d(t,{_:function(){return i}});var i=function(){function n(n){this.l=n}return n.prototype.compute=function(n,t){throw new Error("Not implemented")},n.getKey=function(n,t,r){throw new Error("Not implemented")},n}()},1756:function(n,t,r){r.d(t,{w:function(){return u}});var i,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(i=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(i)?(i=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(i)&&i):i);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},1773:function(n,t,r){r.d(t,{D:function(){return f}});for(var i=r(3354),e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=[],u=0;u<e.length;u++)o[e.charCodeAt(u)]=u;var f={stringify:function(n){var t=n.words,r=n.nSigBytes;n.clamp();for(var i=[],o=0;o<r;o+=3)for(var u=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,f=0;f<4&&o+.75*f<r;f++)i.push(e.charAt(u>>>6*(3-f)&63));var c=e.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(n){var t=n.length,r=e.charAt(64);if(r){var u=n.indexOf(r);-1!==u&&(t=u)}for(var f=[],c=0,a=0;a<t;a++)if(a%4){var s=o[n.charCodeAt(a-1)]<<a%4*2|o[n.charCodeAt(a)]>>>6-a%4*2;f[c>>>2]|=s<<24-c%4*8,c++}return new i.e(f,c)}}},5720:function(n,t,r){r.d(t,{p:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],e=0;e<t;e+=2)r[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new i.e(r,t/2)}}},8702:function(n,t,r){r.d(t,{m:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(n){for(var t=n.length,r=[],e=0;e<t;e++)r[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new i.e(r,t)}}},4768:function(n,t,r){r.d(t,{d:function(){return e}});var i=r(8702),e={stringify:function(n){try{return decodeURIComponent(escape(i.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return i.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,r){r.d(t,{M:function(){return e}});var i=r(1756);var e=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,i.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function r(i){var e=t[i];if(void 0!==e)return e.exports;var o=t[i]={exports:{}};return n[i](o,o.exports,r),o.exports}r.d=function(n,t){for(var i in t)r.o(t,i)&&!r.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"Z",{value:!0})};var i={};return function(){r.r(i),r.d(i,{RC4Drop:function(){return c}});var n,t=r(5693),e=r(9109),o=r(4615),u=(n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(t,r)},function(t,r){function i(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}),f=function(){return(f=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},c=function(n){function r(t){var r=n.call(this,t)||this;return r.drop=192,r.l=t,t&&"number"==typeof t.drop&&(r.drop=t.drop),r.O(),r}return u(r,n),r.prototype.O=function(){n.prototype.O.call(this);for(var t=this.drop;t>0;t--)this.generateKeyStreamWord()},r.createEncryptor=function(n,t){return new r(f(f({},t=void 0===t?{}:t),{key:n}))},r.createDecryptor=function(n,t){return new r(f(f({},t=void 0===t?{}:t),{key:n}))},r.encrypt=function(n,i,o){return"string"==typeof i?t.E.encrypt(r,n,i,o):e.D.encrypt(r,n,i,o)},r.decrypt=function(n,i,o){return"string"==typeof i?t.E.decrypt(r,n,i,o):e.D.decrypt(r,n,i,o)},r}(o.RC4)}(),i}()}));
\ No newline at end of file
... ...
  1 +# jscrypto
  2 +[![npm version](https://badge.fury.io/js/jscrypto.svg)](https://badge.fury.io/js/jscrypto)
  3 +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
  4 +![Build](https://github.com/Hinaser/jscrypto/actions/workflows/test.yml/badge.svg?)
  5 +
  6 +[crypto-js](https://github.com/brix/crypto-js) enhancement for modern js environments.
  7 +
  8 +- Works in modern browsers and **IE9/10/11**.
  9 + \*IE9/10 uses weak random generator on cipher encryption with string password. Use it at your own risk.
  10 + \*If only using decryption or hash/hmac, weak random generator does not cause any trouble.
  11 +- Loadable with ES6/CommonJS/Typescript/Browser runtimes.
  12 +- Support [`GCM`][GCM]/[`GMAC`][GMAC]/[`CCM`][CCM]/[`CBC-MAC`][CBC-MAC] :tada::tada::tada:
  13 +- [CLI commands](#cli) available:
  14 + i.e. `npx jscrypto sha1 "message"`, `npx jscrypto aes enc "message" "password"`, etc.
  15 +- Written in Typescript with rich type declarations.
  16 +- When bundling only SHA256 module, the webpack-ed js file can be less than 6kb.
  17 +- Default parameters for Block cipher (AES/DES/Triple-DES) is tuned to be OpenSSL(1.1.1f) compatible.
  18 + Read further [here](#openssl-compat)
  19 +
  20 +### Breaking changes for version 0.x.x users
  21 +There are several breaking changes between version 0.x and 1.x.
  22 +Please see detail in [CHANGELOG](https://github.com/Hinaser/jscrypto/blob/master/CHANGELOG.md)
  23 +
  24 +
  25 +## Install
  26 +
  27 +```
  28 +npm install jscrypto
  29 +# or
  30 +yarn add jscrypto
  31 +```
  32 +
  33 +If you only want to use [CLI commands](#cli), you don't even need to install `jscrypto`.
  34 +Just dispatch `npx` command like `npx jscrypto sha256 "message"`.
  35 +Read further [here](#cli)
  36 +
  37 +## Usage
  38 +### CommonJS Environment (Node.js environment like node CLI, AWS Lambda, etc)
  39 +```js
  40 +// Load whole library modules.
  41 +const JsCrypto = require("jscrypto");
  42 +console.log(JsCrypto.SHA256.hash("test").toString());
  43 +
  44 +// or load only necessary modules (Recommended for faster loading and reduced size)
  45 +const {SHA256} = require("jscrypto/SHA256");
  46 +console.log(SHA256.hash("test").toString());
  47 +```
  48 +
  49 +### ES6 Environment (i.e. Creating app/library with webpack/react-scripts or some es6-compatible bundlers)
  50 +**Be sure to load the module from `jscrypto/es6`.**
  51 +This can greatly reduce bundle size by bundlers tree-shaking ability.
  52 +Don't forget to add `/es6` following `jscrypto`
  53 +```ecmascript 6
  54 +// Load whole library modules.
  55 +import JsCrypto from "jscrypto/es6";
  56 +console.log(JsCrypto.SHA256.hash("test").toString());
  57 +...
  58 +import {SHA256} from "jscrypto/es6/SHA256"; // Recommended
  59 +console.log(SHA256.hash("test").toString());
  60 +```
  61 +
  62 +### Typescript Environment
  63 +**Be sure to load the module from `jscrypto/es6`.**
  64 +```ecmascript 6
  65 +// Load whole library modules.
  66 +import * as JsCrypto from "jscrypto/es6";
  67 +console.log(JsCrypto.SHA256.hash("test").toString());
  68 +...
  69 +import {SHA256} from "jscrypto/es6/SHA256"; // Recommended
  70 +console.log(SHA256.hash("test").toString());
  71 +```
  72 +
  73 +### Browser
  74 +Copy js files/directories under `/dist` dir into somewhere browser can access.
  75 +Then directly load js file into `<script>` tag.
  76 +```html
  77 +<script src="dist/index.js"></script> <!-- All modules are loaded into browser -->
  78 +<script type="text/javascript">
  79 + // This will output: "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
  80 + console.log(JsCrypto.SHA256.hash("test").toString());
  81 +</script>
  82 +<!-- OR -->
  83 +<script src="dist/SHA256.js"></script> <!-- Single module loading is lightweight and faster. -->
  84 +<script type="text/javascript">
  85 + // This will output: "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
  86 + console.log(JsCrypto.SHA256.hash("test").toString());
  87 +</script>
  88 +```
  89 +
  90 +<h3 id='cli'>CLI</h3>
  91 +
  92 +Command Line Interface to try various crypto modules on terminal.
  93 +```cmd
  94 + Usage: npx jscrypto <hash|hmac|cipher> [command options]
  95 +
  96 + hash: md5, sha1, sha3, sha224, sha256, sha384, sha512, ripemd160
  97 + hmac: hmac-md5, hmac-sha1, hmac-sha224, hmac-sha256, hmac-sha384, hmac-sha512
  98 + cipher: aes, des, des3, rc4
  99 +
  100 +
  101 + $ npx jscrypto <hash> message [-msg hex|base64|utf8] [-out hex|base64]
  102 +
  103 + default:
  104 + -msg: utf8 ... recognize message as utf-8 string
  105 + -out: hex ... output hashed binary as hex string
  106 + example:
  107 + #Output of below 3 examples are the same
  108 + npx jscrypto sha1 test
  109 + npx jscrypto sha1 74657374 -msg hex
  110 + npx jscrypto sha1 dGVzdA== -msg base64
  111 +
  112 +
  113 + $ npx jscrypto <hmac> message key [msg hex|base64|utf8] [-key hex|base64|utf8] [-out hex|base64]
  114 +
  115 + default:
  116 + -msg: utf8 ... recognize message as utf-8 string
  117 + -key: utf8 ... recognize key as utf-8 string
  118 + -out: hex ... output hashed binary as hex string
  119 + example:
  120 + #Output of below 3 examples are the same
  121 + npx jscrypto hmac-sha1 test key
  122 + npx jscrypto hmac-sha1 74657374 6b6579 -msg hex -key hex
  123 + npx jscrypto hmac-sha1 dGVzdA== a2V5 -msg base64 -key base64
  124 +
  125 +
  126 + $ npx jscrypto <cipher> message key [-msg hex|base64|utf8] [-key hex|base64|utf8] [-out hex|base64|utf8] [-mode cbc|ecb|ofb|cfb] [-pad pkcs7|iso10126|iso97971|ansix923|nopadding] [-kdf pbkdf2|evpkdf]
  127 +
  128 + default:
  129 + -msg: utf8 ... recognize message as utf-8 string
  130 + -key: utf8 ... recognize key as utf-8 string
  131 + -out: base64|hex ... base64 on encryption, hex on decryption. Note: utf8 cannot be used on encryption.
  132 + -mode: cbc ... Code block chaining as block cipher mode
  133 + -pad: pkcs7 ... Pkcs7 padding as block padding
  134 + -kdf: pbkdf2 ... PBKDF2 as key derivation function
  135 + example:
  136 + #Encrypt (Output would not be the same because of a random salt, but can be decrypted with the same key)
  137 + npx jscrypto aes enc test password
  138 + npx jscrypto aes enc 74657374 70617373776f7264 -msg hex -key hex
  139 + npx jscrypto aes enc dGVzdA== cGFzc3dvcmQ= -msg base64 -key base64
  140 + #Decrypt
  141 + npx jscrypto aes dec U2FsdGVkX19Kf/wItWMuaTrQYV3OljA3Cr9WPMhC6Tk= password -out utf8
  142 + npx jscrypto aes dec A2pYDd/3oeENsRFGA1Y0Mg== 70617373776f7264 -key hex -out utf8
  143 + npx jscrypto aes dec A2pYDd/3oeENsRFGA1Y0Mg== cGFzc3dvcmQ= -key base64 -out utf8
  144 +```
  145 +
  146 +<h3 id='openssl-compat'>OpenSSL compatibility</h3>
  147 +
  148 +#### Encryption
  149 + ```js
  150 + encryptedData = JsCrypto.AES.encrypt("message", "secret phrase").toString();
  151 + ```
  152 +is equivalent in OpenSSL (1.1.1f) to
  153 + ```shell
  154 + echo -n "message" | openssl enc -e -aes-256-cbc -pass pass:"secret phrase" -base64 -pbkdf2
  155 + # Note: Because of a random salt, everytime it produces different base64 string.
  156 + # But it is OK for decryption.
  157 + ```
  158 +
  159 +#### Decryption
  160 +Encrypted data can be decrypted by
  161 + ```js
  162 + JsCrypto.AES.decrypt(encryptedData, "secret phrase").toString(JsCrypto.Utf8); // "message"
  163 + ```
  164 +or in OpenSSL
  165 + ```shell
  166 + echo "U2FsdGVkX1..." | openssl enc -d -aes-256-cbc -pass pass:"secret phrase" -base64 -pbkdf2
  167 + # U2FsdGVkX1... is the output from either JsCrypto/OpenSSL encryption code/command.
  168 + ```
  169 +
  170 +## FAQ
  171 +#### Failed to import jscrypto in Typescript environment.
  172 +
  173 +In most cases, your `tsconfig.json` is configured not to load npm module from `node_modules` folder.
  174 +Check your `tsconfig.js` to be:
  175 +```json
  176 +{
  177 + "compilerOptions": {
  178 + "moduleResolution": "Node"
  179 + }
  180 +}
  181 +```
  182 +
  183 +## API
  184 +`jscrypto` supports crypto modules as well as `cryptojs`.
  185 +
  186 +### *Popular*
  187 +**Hash** [`MD5`][MD5], [`SHA1`][SHA1], [`SHA3`][SHA3], [`SHA224`][SHA224], [`SHA256`][SHA256], [`SHA384`][SHA384], [`SHA512`][SHA512], [`RIPEMD160`][RIPEMD160],
  188 +**Message/Key Hash** [`HMAC-MD5`][HMAC-MD5], [`HMAC-SHA224`][HMAC-SHA224], [`HMAC-SHA256`][HMAC-SHA256], [`HMAC-SHA384`][HMAC-SHA384], [`HMAC-SHA512`][HMAC-SHA512], [`GMAC`][GMAC], [`CBC-MAC`][CBC-MAC]
  189 +**Block Cipher** [`AES`][AES], [`DES`][DES], [`Triple-DES`][Triple-DES]
  190 +
  191 +### *Basic structure*
  192 +**Word** [`Word32Array`][Word32Array], [`Word64Array`][Word64Array]
  193 +**Encoder** [`Base64`][Base64], [`Hex`][Hex], [`Latin1`][Latin1], [`Utf8`][Utf8], [`Utf16`][Utf16]
  194 +
  195 +### *Misc*
  196 +**Stream Cipher** [`Rabbits`][Rabbits], [`RC4`][RC4], [`RC4Drop`][RC4Drop]
  197 +**Key Derive Function** [`OpenSSLKDF`][OpenSSLKDF], [`EvpKDF`][EvpKDF], [`PBKDF2`][PBKDF2]
  198 +**Block Cipher mode** [`CBC`][CBC], [`CFB`][CFB], [`CTR`][CTR], [`ECB`][ECB], [`OFB`][OFB], [`GCM`][GCM], [`CCM`][CCM]
  199 +**Block Padding** [`AnsiX923`][AnsiX923], [`ISO10126`][ISO10126], [`ISO97971`][ISO97971], [`NoPadding`][NoPadding], [`Pkcs7`][Pkcs7], [`Zero`][Zero]
  200 +**Formatter** [`OpenSSLFormatter`][OpenSSLFormatter]
  201 +
  202 +[MD5]: https://github.com/Hinaser/jscrypto/blob/master/API.md#md5
  203 +[SHA1]: https://github.com/Hinaser/jscrypto/blob/master/API.md#sha1
  204 +[SHA3]: https://github.com/Hinaser/jscrypto/blob/master/API.md#sha3
  205 +[SHA224]: https://github.com/Hinaser/jscrypto/blob/master/API.md#sha224
  206 +[SHA256]: https://github.com/Hinaser/jscrypto/blob/master/API.md#sha256
  207 +[SHA384]: https://github.com/Hinaser/jscrypto/blob/master/API.md#sha384
  208 +[SHA512]: https://github.com/Hinaser/jscrypto/blob/master/API.md#sha512
  209 +[RIPEMD160]: https://github.com/Hinaser/jscrypto/blob/master/API.md#ripemd160
  210 +[HMAC-MD5]: https://github.com/Hinaser/jscrypto/blob/master/API.md#hmac-md5
  211 +[HMAC-SHA224]: https://github.com/Hinaser/jscrypto/blob/master/API.md#hmac-sha224
  212 +[HMAC-SHA256]: https://github.com/Hinaser/jscrypto/blob/master/API.md#hmac-sha256
  213 +[HMAC-SHA384]: https://github.com/Hinaser/jscrypto/blob/master/API.md#hmac-sha384
  214 +[HMAC-SHA512]: https://github.com/Hinaser/jscrypto/blob/master/API.md#hmac-sha512
  215 +[GMAC]: https://github.com/Hinaser/jscrypto/blob/master/API.md#gmac
  216 +[CBC-MAC]: https://github.com/Hinaser/jscrypto/blob/master/API.md#cbc-mac
  217 +[AES]: https://github.com/Hinaser/jscrypto/blob/master/API.md#aes
  218 +[AES-GCM]: https://github.com/Hinaser/jscrypto/blob/master/API.md#aes-gcm
  219 +[AES-CCM]: https://github.com/Hinaser/jscrypto/blob/master/API.md#aes-ccm
  220 +[DES]: https://github.com/Hinaser/jscrypto/blob/master/API.md#des
  221 +[Triple-DES]: https://github.com/Hinaser/jscrypto/blob/master/API.md#des3
  222 +[Word32Array]: https://github.com/Hinaser/jscrypto/blob/master/API.md#word32array
  223 +[Word64Array]: https://github.com/Hinaser/jscrypto/blob/master/API.md#mword64Array
  224 +[Base64]: https://github.com/Hinaser/jscrypto/blob/master/API.md#base64
  225 +[Hex]: https://github.com/Hinaser/jscrypto/blob/master/API.md#hex
  226 +[Latin1]: https://github.com/Hinaser/jscrypto/blob/master/API.md#latin1
  227 +[Utf8]: https://github.com/Hinaser/jscrypto/blob/master/API.md#utf8
  228 +[Utf16]: https://github.com/Hinaser/jscrypto/blob/master/API.md#utf16
  229 +[Rabbits]: https://github.com/Hinaser/jscrypto/blob/master/API.md#rabbits
  230 +[RC4]: https://github.com/Hinaser/jscrypto/blob/master/API.md#rc4
  231 +[RC4Drop]: https://github.com/Hinaser/jscrypto/blob/master/API.md#rc4drop
  232 +[OpenSSLKDF]: https://github.com/Hinaser/jscrypto/blob/master/API.md#opensslkdf
  233 +[EvpKDF]: https://github.com/Hinaser/jscrypto/blob/master/API.md#evpkdf
  234 +[PBKDF2]: https://github.com/Hinaser/jscrypto/blob/master/API.md#pbkdf2
  235 +[CBC]: https://github.com/Hinaser/jscrypto/blob/master/API.md#cbc
  236 +[CFB]: https://github.com/Hinaser/jscrypto/blob/master/API.md#cfb
  237 +[CTR]: https://github.com/Hinaser/jscrypto/blob/master/API.md#ctr
  238 +[ECB]: https://github.com/Hinaser/jscrypto/blob/master/API.md#ecb
  239 +[OFB]: https://github.com/Hinaser/jscrypto/blob/master/API.md#ofb
  240 +[GCM]: https://github.com/Hinaser/jscrypto/blob/master/API.md#gcm
  241 +[CCM]: https://github.com/Hinaser/jscrypto/blob/master/API.md#ccm
  242 +[AnsiX923]: https://github.com/Hinaser/jscrypto/blob/master/API.md#ansix923
  243 +[ISO10126]: https://github.com/Hinaser/jscrypto/blob/master/API.md#iso10126
  244 +[ISO97971]: https://github.com/Hinaser/jscrypto/blob/master/API.md#iso97971
  245 +[NoPadding]: https://github.com/Hinaser/jscrypto/blob/master/API.md#nopadding
  246 +[Pkcs7]: https://github.com/Hinaser/jscrypto/blob/master/API.md#pkcs7
  247 +[Zero]: https://github.com/Hinaser/jscrypto/blob/master/API.md#zero
  248 +[OpenSSLFormatter]: https://github.com/Hinaser/jscrypto/blob/master/API.md#opensslformatter
... ...
  1 +[crypto-js](https://github.com/brix/crypto-js) /
  2 +[The MIT License (MIT)](http://opensource.org/licenses/MIT)
  3 +Copyright (c) 2009-2013 Jeff Mott
  4 +Copyright (c) 2013-2016 Evan Vosberg
  5 +
  6 +[crypto-es](https://github.com/entronad/crypto-es) /
  7 +[The MIT License (MIT)](http://opensource.org/licenses/MIT)
  8 +Copyright (c) 2018-2020 LIN Chen
  9 +
  10 +[NIST Special Publication 800-38D](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf)
  11 +NIST/Morris Dworkin
  12 +
  13 +[NIST Special Publication 800-38C](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38c.pdf)
  14 +NIST/Morris Dworkin
... ...
  1 +/** @preserve
  2 +(c) 2012 by Cédric Mesnil. All rights reserved.
  3 +Redistribution and use in source and binary forms, with or without modification,
  4 + are permitted provided that the following conditions are met:
  5 +
  6 +- Redistributions of source code must retain the above copyright notice,
  7 + this list of conditions and the following disclaimer.
  8 +- Redistributions in binary form must reproduce the above copyright notice,
  9 + this list of conditions and the following disclaimer in the documentation
  10 + and/or other materials provided with the distribution.
  11 +
  12 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
  13 +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14 +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  15 +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  16 +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  17 +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  18 +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  19 + */
  20 +import { Hasher, HasherProps } from "./lib/algorithm/Hasher";
  21 +import { Word32Array } from "./lib/Word32Array";
  22 +export interface RIPEMD160Props extends HasherProps {
  23 + hash: Word32Array;
  24 +}
  25 +export declare class RIPEMD160 extends Hasher {
  26 + protected _props?: Partial<RIPEMD160Props>;
  27 + private _hash;
  28 + constructor(props?: RIPEMD160Props);
  29 + protected _doReset(): void;
  30 + protected _doProcessBlock(words: number[], offset: number): void;
  31 + protected _doFinalize(): Word32Array;
  32 + clone(): RIPEMD160;
  33 + static hash(message: Word32Array | string, props?: RIPEMD160Props): Word32Array;
  34 +}
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var e in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[e]=r[e]}}(this,(function(){return function(){"use strict";var n={3354:function(n,t,r){r.d(t,{e:function(){return o}});var e=r(5720),i=r(9054),o=function(){function n(t,r){if(Array.isArray(t)||!t)return this.t=Array.isArray(t)?t:[],void(this.i="number"==typeof r?r:4*this.t.length);if(t instanceof n)return this.t=t.words.slice(),void(this.i=t.nSigBytes);var e;try{t instanceof ArrayBuffer?e=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!e)throw new Error("Invalid argument");for(var i=e.byteLength,o=[],u=0;u<i;u++)o[u>>>2]|=e[u]<<24-u%4*8;this.t=o,this.i=i}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.i},set:function(n){this.i=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.t},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):e.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.t,t=this.i,r=new Uint8Array(t),e=0;e<t;e++)r[e]=n[e>>>2]>>>24-e%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.i%4)for(var e=0;e<r;e++){var i=t[e>>>2]>>>24-e%4*8&255;this.t[this.i+e>>>2]|=i<<24-(this.i+e)%4*8}else for(e=0;e<r;e+=4)this.t[this.i+e>>>2]=t[e>>>2];return this.i+=r,this},n.prototype.clamp=function(){var n=this.i;this.t[n>>>2]&=4294967295<<32-n%4*8,this.t.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.t.slice(),this.i)},n.random=function(t){for(var r=[],e=0;e<t;e+=4)r.push((0,i.M)());return new n(r,t)},n}()},7211:function(n,t,r){r.d(t,{C:function(){return o}});var e=r(3354),i=r(4768),o=function(){function n(n){this.u=0,this.h=0,this.v=n,this.l=n&&void 0!==n.data?n.data.clone():new e.e,this.j=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.h},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.l=void 0!==n?n.clone():new e.e,this.j="number"==typeof t?t:0},n.prototype.A=function(n){var t="string"==typeof n?i.d.parse(n):n;this.l.concat(t),this.j+=t.nSigBytes},n.prototype.I=function(n){var t,r=this.l.words,i=this.l.nSigBytes,o=this.h,u=i/(4*this.h),f=(u=n?Math.ceil(u):Math.max((0|u)-this.u,0))*o,c=Math.min(4*f,i);if(f){for(var a=0;a<f;a+=o)this.O(r,a);t=r.splice(0,f),this.l.nSigBytes-=c}return new e.e(t,c)},n.prototype.O=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,r){r.d(t,{P:function(){return u}});var e,i=r(7211),o=(e=function(n,t){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}e(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.h=16,r.v=t,t&&"number"==typeof t.blockSize&&(r.h=t.blockSize),r.reset(t?t.data:void 0,t?t.nBytes:void 0),r}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.h},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.U()},t.prototype.update=function(n){return this.A(n),this.I(),this},t.prototype.finalize=function(n){return n&&this.A(n),this._()},t.prototype.U=function(){throw new Error("Not implemented")},t.prototype._=function(){throw new Error("Not implemented")},t}(i.C)},1756:function(n,t,r){r.d(t,{w:function(){return u}});var e,i="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(e=parseInt((/msie (\d+)/.exec(i)||[])[1],10),isNaN(e)?(e=parseInt((/trident\/.*; rv:(\d+)/.exec(i)||[])[1],10),!isNaN(e)&&e):e);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},5720:function(n,t,r){r.d(t,{p:function(){return i}});var e=r(3354),i={stringify:function(n){for(var t=n.nSigBytes,r=n.words,e=[],i=0;i<t;i++){var o=r[i>>>2]>>>24-i%4*8&255;e.push((o>>>4).toString(16)),e.push((15&o).toString(16))}return e.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],i=0;i<t;i+=2)r[i>>>3]|=parseInt(n.substr(i,2),16)<<24-i%8*4;return new e.e(r,t/2)}}},8702:function(n,t,r){r.d(t,{m:function(){return i}});var e=r(3354),i={stringify:function(n){for(var t=n.nSigBytes,r=n.words,e=[],i=0;i<t;i++){var o=r[i>>>2]>>>24-i%4*8&255;e.push(String.fromCharCode(o))}return e.join("")},parse:function(n){for(var t=n.length,r=[],i=0;i<t;i++)r[i>>>2]|=(255&n.charCodeAt(i))<<24-i%4*8;return new e.e(r,t)}}},4768:function(n,t,r){r.d(t,{d:function(){return i}});var e=r(8702),i={stringify:function(n){try{return decodeURIComponent(escape(e.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return e.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,r){r.d(t,{M:function(){return i}});var e=r(1756);var i=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,e.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function r(e){var i=t[e];if(void 0!==i)return i.exports;var o=t[e]={exports:{}};return n[e](o,o.exports,r),o.exports}r.d=function(n,t){for(var e in t)r.o(t,e)&&!r.o(n,e)&&Object.defineProperty(n,e,{enumerable:!0,get:t[e]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"S",{value:!0})};var e={};return function(){r.r(e),r.d(e,{RIPEMD160:function(){return p}});var n,t=r(1868),i=r(3354),o=(n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(t,r)},function(t,r){function e(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}),u=new i.e([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),f=new i.e([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=new i.e([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),a=new i.e([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),s=new i.e([0,1518500249,1859775393,2400959708,2840853838]),h=new i.e([1352829926,1548603684,1836072691,2053994217,0]);function v(n,t,r){return n^t^r}function w(n,t,r){return n&t|~n&r}function d(n,t,r){return(n|~t)^r}function l(n,t,r){return n&r|t&~r}function y(n,t,r){return n^(t|~r)}function b(n,t){return n<<t|n>>>32-t}var p=function(n){function t(t){var r=n.call(this,t)||this;return r.N=new i.e([1732584193,4023233417,2562383102,271733878,3285377520]),r.v=t,t&&void 0!==t.hash&&(r.N=t.hash.clone()),r}return o(t,n),t.prototype.U=function(){this.N=new i.e([1732584193,4023233417,2562383102,271733878,3285377520])},t.prototype.O=function(n,t){for(var r=0;r<16;r++){var e=t+r,i=n[e];n[e]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o,p,m,g,j,A,I,O,E,M,U,_=this.N.words,S=s.words,N=h.words,x=u.words,C=f.words,F=c.words,k=a.words;A=o=_[0],I=p=_[1],O=m=_[2],E=g=_[3],M=j=_[4];for(r=0;r<80;r+=1)U=o+n[t+x[r]]|0,U+=r<16?v(p,m,g)+S[0]:r<32?w(p,m,g)+S[1]:r<48?d(p,m,g)+S[2]:r<64?l(p,m,g)+S[3]:y(p,m,g)+S[4],U=(U=b(U|=0,F[r]))+j|0,o=j,j=g,g=b(m,10),m=p,p=U,U=A+n[t+C[r]]|0,U+=r<16?y(I,O,E)+N[0]:r<32?l(I,O,E)+N[1]:r<48?d(I,O,E)+N[2]:r<64?w(I,O,E)+N[3]:v(I,O,E)+N[4],U=(U=b(U|=0,k[r]))+M|0,A=M,M=E,E=b(O,10),O=I,I=U;U=_[1]+m+E|0,_[1]=_[2]+g+M|0,_[2]=_[3]+j+A|0,_[3]=_[4]+o+I|0,_[4]=_[0]+p+O|0,_[0]=U},t.prototype._=function(){var n=this.l,t=n.words,r=8*this.j,e=8*n.nSigBytes;t[e>>>5]|=128<<24-e%32,t[14+(e+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),n.nSigBytes=4*(t.length+1),this.I();for(var i=this.N,o=i.words,u=0;u<5;u++){var f=o[u];o[u]=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8)}return i},t.prototype.clone=function(){return new t({hash:this.N,blockSize:this.h,data:this.l,nBytes:this.j})},t.hash=function(n,r){return new t(r).finalize(n)},t}(t.P)}(),e}()}));
\ No newline at end of file
... ...
  1 +import { CipherProps, PropsWithKey } from "./lib/algorithm/cipher/Cipher";
  2 +import type { Word32Array } from "./lib/Word32Array";
  3 +import { StreamCipher } from "./lib/algorithm/cipher/StreamCipher";
  4 +import { CipherParams } from "./lib/algorithm/cipher/CipherParams";
  5 +export interface RabbitProps extends CipherProps {
  6 +}
  7 +export declare class Rabbit extends StreamCipher {
  8 + protected _blockSize: number;
  9 + static readonly ivSize: number;
  10 + protected _props: PropsWithKey<RabbitProps>;
  11 + protected S: number[];
  12 + protected C: number[];
  13 + protected G: number[];
  14 + protected _X: number[];
  15 + protected _C: number[];
  16 + protected _b: number;
  17 + constructor(props: PropsWithKey<RabbitProps>);
  18 + protected _doReset(): void;
  19 + protected _doProcessBlock(words: number[], offset: number): void;
  20 + protected nextState(): void;
  21 + /**
  22 + * Creates this cipher in encryption mode.
  23 + *
  24 + * @param {Word32Array} key The key.
  25 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  26 + * @return {Cipher} A cipher instance.
  27 + * @example
  28 + * var cipher = Rabbit.createEncryptor(keyWordArray);
  29 + */
  30 + static createEncryptor(key: Word32Array, props?: Partial<CipherProps>): Rabbit;
  31 + /**
  32 + * Creates this cipher in decryption mode.
  33 + *
  34 + * @param {Word32Array} key The key.
  35 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  36 + * @return {Cipher} A cipher instance.
  37 + * @example
  38 + * var cipher = Rabbit.createDecryptor(keyWordArray, { iv: ivWordArray });
  39 + */
  40 + static createDecryptor(key: Word32Array, props?: Partial<CipherProps>): Rabbit;
  41 + /**
  42 + * Encrypt a message with key
  43 + *
  44 + * @param {Word32Array|string} message
  45 + * @param {Word32Array|string} key
  46 + * @param {Partial<AESProps>?} props
  47 + * @example
  48 + * var encryptedMessage = Rabbit.encrypt("test", "pass");
  49 + */
  50 + static encrypt(message: Word32Array | string, key: Word32Array | string, props?: Partial<RabbitProps>): CipherParams;
  51 + /**
  52 + * Encrypt a encrypted message with key
  53 + *
  54 + * @param {CipherParams} cipherText
  55 + * @param {Word32Array|string} key
  56 + * @param {Partial<AESProps>?} props
  57 + * @example
  58 + * var encryptedMessage = Rabbit.decrypt(cipherProps, "pass");
  59 + */
  60 + static decrypt(cipherText: CipherParams, key: Word32Array | string, props?: Partial<RabbitProps>): Word32Array;
  61 +}
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var i in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[i]=r[i]}}(this,(function(){return function(){"use strict";var n={6367:function(n,t,r){r.d(t,{Hmac:function(){return e}});var i=r(4768),e=function(){function n(n,t){this.i=n,"string"==typeof t&&(t=i.d.parse(t));var r=n.blockSize,e=4*r;t.nSigBytes>e&&(t=n.finalize(t)),t.clamp();for(var o=this.u=t.clone(),u=this.h=t.clone(),f=o.words,c=u.words,s=0;s<r;s++)f[s]^=1549556828,c[s]^=909522486;u.nSigBytes=e,o.nSigBytes=e,this.reset()}return n.prototype.reset=function(){this.i.reset(),this.i.update(this.h)},n.prototype.update=function(n){return this.i.update(n),this},n.prototype.finalize=function(n){var t=this.i.finalize(n);return this.i.reset(),this.i.finalize(this.u.clone().concat(t))},n}()},5561:function(n,t,r){r.d(t,{SHA256:function(){return v}});var i,e=r(1868),o=r(3354),u=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),f=[],c=[];function s(n){for(var t=Math.sqrt(n),r=2;r<=t;r++)if(!(n%r))return!1;return!0}function a(n){return 4294967296*(n-(0|n))|0}!function(){for(var n=2,t=0;t<64;)s(n)&&(t<8&&(f[t]=a(Math.pow(n,.5))),c[t]=a(Math.pow(n,1/3)),t++),n++}();var h=[],v=function(n){function t(t){var r=n.call(this,t)||this;return r.v=new o.e(f.slice(0)),r.l=t,t&&void 0!==t.hash&&(r.v=t.hash.clone()),r}return u(t,n),t.prototype.j=function(){this.v=new o.e(f.slice(0))},t.prototype.O=function(n,t){for(var r=this.v.words,i=r[0],e=r[1],o=r[2],u=r[3],f=r[4],s=r[5],a=r[6],v=r[7],w=0;w<64;w++){if(w<16)h[w]=0|n[t+w];else{var d=h[w-15],l=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,b=h[w-2],y=(b<<15|b>>>17)^(b<<13|b>>>19)^b>>>10;h[w]=l+h[w-7]+y+h[w-16]}var p=i&e^i&o^e&o,m=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),j=v+((f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25))+(f&s^~f&a)+c[w]+h[w];v=a,a=s,s=f,f=u+j|0,u=o,o=e,e=i,i=j+(m+p)|0}r[0]=r[0]+i|0,r[1]=r[1]+e|0,r[2]=r[2]+o|0,r[3]=r[3]+u|0,r[4]=r[4]+f|0,r[5]=r[5]+s|0,r[6]=r[6]+a|0,r[7]=r[7]+v|0},t.prototype.A=function(){var n=this.I.words,t=8*this.k,r=8*this.I.nSigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=Math.floor(t/4294967296),n[15+(r+64>>>9<<4)]=t,this.I.nSigBytes=4*n.length,this.N(),this.v},t.prototype.clone=function(){return new t({hash:this.v,blockSize:this.U,data:this.I,nBytes:this.k})},t.hash=function(n,r){return new t(r).finalize(n)},t}(e.P)},3354:function(n,t,r){r.d(t,{e:function(){return o}});var i=r(5720),e=r(9054),o=function(){function n(t,r){if(Array.isArray(t)||!t)return this.F=Array.isArray(t)?t:[],void(this.H="number"==typeof r?r:4*this.F.length);if(t instanceof n)return this.F=t.words.slice(),void(this.H=t.nSigBytes);var i;try{t instanceof ArrayBuffer?i=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!i)throw new Error("Invalid argument");for(var e=i.byteLength,o=[],u=0;u<e;u++)o[u>>>2]|=i[u]<<24-u%4*8;this.F=o,this.H=e}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.H},set:function(n){this.H=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.F},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):i.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.F,t=this.H,r=new Uint8Array(t),i=0;i<t;i++)r[i]=n[i>>>2]>>>24-i%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.H%4)for(var i=0;i<r;i++){var e=t[i>>>2]>>>24-i%4*8&255;this.F[this.H+i>>>2]|=e<<24-(this.H+i)%4*8}else for(i=0;i<r;i+=4)this.F[this.H+i>>>2]=t[i>>>2];return this.H+=r,this},n.prototype.clamp=function(){var n=this.H;this.F[n>>>2]&=4294967295<<32-n%4*8,this.F.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.F.slice(),this.H)},n.random=function(t){for(var r=[],i=0;i<t;i+=4)r.push((0,e.M)());return new n(r,t)},n}()},7211:function(n,t,r){r.d(t,{C:function(){return o}});var i=r(3354),e=r(4768),o=function(){function n(n){this.T=0,this.U=0,this.l=n,this.I=n&&void 0!==n.data?n.data.clone():new i.e,this.k=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.U},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.I=void 0!==n?n.clone():new i.e,this.k="number"==typeof t?t:0},n.prototype.B=function(n){var t="string"==typeof n?e.d.parse(n):n;this.I.concat(t),this.k+=t.nSigBytes},n.prototype.N=function(n){var t,r=this.I.words,e=this.I.nSigBytes,o=this.U,u=e/(4*this.U),f=(u=n?Math.ceil(u):Math.max((0|u)-this.T,0))*o,c=Math.min(4*f,e);if(f){for(var s=0;s<f;s+=o)this.O(r,s);t=r.splice(0,f),this.I.nSigBytes-=c}return new i.e(t,c)},n.prototype.O=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,r){r.d(t,{P:function(){return u}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.U=16,r.l=t,t&&"number"==typeof t.blockSize&&(r.U=t.blockSize),r.reset(t?t.data:void 0,t?t.nBytes:void 0),r}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.U},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.j()},t.prototype.update=function(n){return this.B(n),this.N(),this},t.prototype.finalize=function(n){return n&&this.B(n),this.A()},t.prototype.j=function(){throw new Error("Not implemented")},t.prototype.A=function(){throw new Error("Not implemented")},t}(e.C)},9456:function(n,t,r){r.d(t,{t:function(){return f}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(){return(u=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},f=function(n){function t(t){var r=n.call(this,t)||this;return r.R=1,r.l=t,r.J=t.key,r.K=void 0!==t.iv?t.iv:r.K,r.R=void 0!==t.transformMode?t.transformMode:r.R,r}return o(t,n),Object.defineProperty(t.prototype,"iv",{get:function(){return this.K},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.j()},t.prototype.process=function(n){return this.B(n),this.N()},t.prototype.finalize=function(n){return n&&this.B(n),this.A()},t.prototype.j=function(){throw new Error("Not implemented")},t.prototype.O=function(n,t){throw new Error("Not implemented")},t.prototype.A=function(){throw new Error("Not implemented")},t.createEncryptor=function(n,r){return new t(u(u({},r=void 0===r?{}:r),{key:n,transformMode:t.ENC_TRANSFORM_MODE}))},t.createDecryptor=function(n,r){return new t(u(u({},r=void 0===r?{}:r),{key:n,transformMode:t.DEC_TRANSFORM_MODE}))},t.ENC_TRANSFORM_MODE=1,t.DEC_TRANSFORM_MODE=2,t.keySize=4,t.ivSize=4,t}(e.C)},2505:function(n,t,r){r.d(t,{Q:function(){return e}});var i=r(1232),e=function(){function n(n){this.formatter=i.w,n&&(this.cipherText=n.cipherText,this.key=n.key,this.iv=n.iv,this.salt=n.salt,this.Algorithm=n.Algorithm,this.mode=n.mode,this.padding=n.padding,this.blockSize=n.blockSize,this.formatter=n.formatter||i.w)}return n.prototype.toString=function(n){return(n||this.formatter).stringify(this)},n}()},5693:function(n,t,r){r.d(t,{E:function(){return c}});var i=r(9109),e=r(2214),o=r(2505),u=r(1232),f=function(){return(f=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},c={encrypt:function(n,t,r,u){var c=u?f({},u):{},s=u&&u.KDF?u.KDF:e.s,a={};u&&u.kdfHasher&&(a.kdfHasher=u.kdfHasher),u&&u.kdfIterations&&(a.kdfIterations=u.kdfIterations),u&&u.kdfModule&&(a.kdfModule=u.kdfModule);var h=s.execute(r,n.keySize,n.ivSize,c.kdfSalt,a);c.iv=h.iv;var v=i.D.encrypt(n,t,h.key,c);return new o.Q(f(f({},v),{key:h.key,iv:h.iv,salt:h.salt}))},decrypt:function(n,t,r,o){var c=o?f({},o):{},s=c.KDF?c.KDF:e.s,a=c.formatter?c.formatter:u.w,h=(0,i.W)(t,a),v={};o&&o.kdfHasher&&(v.kdfHasher=o.kdfHasher),o&&o.kdfIterations&&(v.kdfIterations=o.kdfIterations),o&&o.kdfModule&&(v.kdfModule=o.kdfModule);var w=s.execute(r,n.keySize,n.ivSize,h.salt,v);return c.iv=w.iv,i.D.decrypt(n,h,w.key,c)}}},9109:function(n,t,r){r.d(t,{W:function(){return o},D:function(){return u}});var i=r(1232),e=r(2505);function o(n,t){return"string"==typeof n?t.parse(n):n}var u={encrypt:function(n,t,r,o){var u=n.createEncryptor(r,o),f=u.finalize(t);return new e.Q({cipherText:f,key:r,iv:u.iv,Algorithm:n,mode:u.mode,padding:u.padding,blockSize:u.blockSize,formatter:(null==o?void 0:o.formatter)||i.w})},decrypt:function(n,t,r,e){var u=n.createDecryptor(r,e),f=o(t,(null==e?void 0:e.formatter)||i.w);return u.finalize(f.cipherText||"")}}},30:function(n,t,r){r.d(t,{q:function(){return u}});var i,e=r(9456),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.U=1,r}return o(t,n),t.prototype.A=function(){return this.N(!0)},t}(e.t)},1232:function(n,t,r){r.d(t,{w:function(){return u}});var i=r(2505),e=r(3354),o=r(1773),u={stringify:function(n){var t=n.cipherText,r=n.salt;return t?r?new e.e([1398893684,1701076831]).concat(r).concat(t).toString(o.D):t.toString(o.D):""},parse:function(n){var t,r=o.D.parse(n),u=r.words;return 1398893684===u[0]&&1701076831===u[1]&&(t=new e.e(u.slice(2,4)),u.splice(0,4),r.nSigBytes-=16),new i.Q({cipherText:r,salt:t})}}},2214:function(n,t,r){r.d(t,{s:function(){return f}});var i=r(3354),e=r(2505),o=r(7008),u=function(){return(u=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},f={execute:function(n,t,r,f,c){f||(f=i.e.random(8));var s=c&&c.kdfModule||o.E,a=c?{Hasher:c.kdfHasher,iterations:c.kdfIterations}:{},h=s.getKey(n,f,u(u({},a),{keySize:t+r})),v=new i.e(h.words.slice(t),4*r);return h.nSigBytes=4*t,new e.Q({key:h,iv:v,salt:f})}}},7008:function(n,t,r){r.d(t,{E:function(){return s}});var i,e=r(5561),o=r(6367),u=r(3354),f=r(9541),c=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),s=function(n){function t(t){var r=n.call(this,t)||this;return r.L=4,r.V=e.SHA256,r.X=1e4,t&&(r.L=void 0!==t.keySize?t.keySize:r.L,r.V=void 0!==t.Hasher?t.Hasher:r.V,r.X=void 0!==t.iterations?t.iterations:r.X),r}return c(t,n),t.prototype.compute=function(n,t){for(var r=new o.Hmac(new this.V,n),i=new u.e,e=new u.e([1]),f=i.words,c=e.words,s=this.L,a=this.X;f.length<s;){var h=r.update(t).finalize(e);r.reset();for(var v=h.words,w=v.length,d=h,l=1;l<a;l++){d=r.finalize(d),r.reset();for(var b=d.words,y=0;y<w;y++)v[y]^=b[y]}i.concat(h),c[0]++}return i.nSigBytes=4*s,i},t.getKey=function(n,r,i){return new t(i).compute(n,r)},t}(f._)},9541:function(n,t,r){r.d(t,{_:function(){return i}});var i=function(){function n(n){this.l=n}return n.prototype.compute=function(n,t){throw new Error("Not implemented")},n.getKey=function(n,t,r){throw new Error("Not implemented")},n}()},1756:function(n,t,r){r.d(t,{w:function(){return u}});var i,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(i=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(i)?(i=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(i)&&i):i);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},1773:function(n,t,r){r.d(t,{D:function(){return f}});for(var i=r(3354),e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=[],u=0;u<e.length;u++)o[e.charCodeAt(u)]=u;var f={stringify:function(n){var t=n.words,r=n.nSigBytes;n.clamp();for(var i=[],o=0;o<r;o+=3)for(var u=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,f=0;f<4&&o+.75*f<r;f++)i.push(e.charAt(u>>>6*(3-f)&63));var c=e.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(n){var t=n.length,r=e.charAt(64);if(r){var u=n.indexOf(r);-1!==u&&(t=u)}for(var f=[],c=0,s=0;s<t;s++)if(s%4){var a=o[n.charCodeAt(s-1)]<<s%4*2|o[n.charCodeAt(s)]>>>6-s%4*2;f[c>>>2]|=a<<24-c%4*8,c++}return new i.e(f,c)}}},5720:function(n,t,r){r.d(t,{p:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],e=0;e<t;e+=2)r[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new i.e(r,t/2)}}},8702:function(n,t,r){r.d(t,{m:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(n){for(var t=n.length,r=[],e=0;e<t;e++)r[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new i.e(r,t)}}},4768:function(n,t,r){r.d(t,{d:function(){return e}});var i=r(8702),e={stringify:function(n){try{return decodeURIComponent(escape(i.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return i.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,r){r.d(t,{M:function(){return e}});var i=r(1756);var e=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,i.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function r(i){var e=t[i];if(void 0!==e)return e.exports;var o=t[i]={exports:{}};return n[i](o,o.exports,r),o.exports}r.d=function(n,t){for(var i in t)r.o(t,i)&&!r.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"Y",{value:!0})};var i={};return function(){r.r(i),r.d(i,{Rabbit:function(){return c}});var n,t=r(30),e=r(5693),o=r(9109),u=(n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(t,r)},function(t,r){function i(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}),f=function(){return(f=Object.assign||function(n){for(var t,r=1,i=arguments.length;r<i;r++)for(var e in t=arguments[r])Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n}).apply(this,arguments)},c=function(n){function t(t){var r=n.call(this,t)||this;return r.U=4,r.S=[],r.C=[],r.G=[],r.Z=[],r.$=[],r.nn=0,r.l=t,r.j(),r}return u(t,n),t.prototype.j=function(){for(var n=this.J.words,t=this.K,r=0;r<4;r++)n[r]=16711935&(n[r]<<8|n[r]>>>24)|4278255360&(n[r]<<24|n[r]>>>8);var i=this.Z=[n[0],n[3]<<16|n[2]>>>16,n[1],n[0]<<16|n[3]>>>16,n[2],n[1]<<16|n[0]>>>16,n[3],n[2]<<16|n[1]>>>16],e=this.$=[n[2]<<16|n[2]>>>16,4294901760&n[0]|65535&n[1],n[3]<<16|n[3]>>>16,4294901760&n[1]|65535&n[2],n[0]<<16|n[0]>>>16,4294901760&n[2]|65535&n[3],n[1]<<16|n[1]>>>16,4294901760&n[3]|65535&n[0]];this.nn=0;for(r=0;r<4;r++)this.nextState();for(r=0;r<8;r++)e[r]^=i[r+4&7];if(t){var o=t.words,u=o[0],f=o[1],c=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8),s=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),a=c>>>16|4294901760&s,h=s<<16|65535&c;e[0]^=c,e[1]^=a,e[2]^=s,e[3]^=h,e[4]^=c,e[5]^=a,e[6]^=s,e[7]^=h;for(r=0;r<4;r++)this.nextState()}},t.prototype.O=function(n,t){var r=this.Z;this.nextState(),this.S[0]=r[0]^r[5]>>>16^r[3]<<16,this.S[1]=r[2]^r[7]>>>16^r[5]<<16,this.S[2]=r[4]^r[1]>>>16^r[7]<<16,this.S[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)this.S[i]=16711935&(this.S[i]<<8|this.S[i]>>>24)|4278255360&(this.S[i]<<24|this.S[i]>>>8),n[t+i]^=this.S[i]},t.prototype.nextState=function(){for(var n=this.Z,t=this.$,r=0;r<8;r++)this.C[r]=t[r];t[0]=t[0]+1295307597+this.nn|0,t[1]=t[1]+3545052371+(t[0]>>>0<this.C[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<this.C[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<this.C[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<this.C[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<this.C[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<this.C[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<this.C[6]>>>0?1:0)|0,this.nn=t[7]>>>0<this.C[7]>>>0?1:0;for(r=0;r<8;r++){var i=n[r]+t[r],e=65535&i,o=i>>>16,u=((e*e>>>17)+e*o>>>15)+o*o,f=((4294901760&i)*i|0)+((65535&i)*i|0);this.G[r]=u^f}var c=this.G;n[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,n[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,n[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,n[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,n[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,n[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,n[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,n[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0},t.createEncryptor=function(n,r){return new t(f(f({},r=void 0===r?{}:r),{key:n}))},t.createDecryptor=function(n,r){return new t(f(f({},r=void 0===r?{}:r),{key:n}))},t.encrypt=function(n,r,i){return"string"==typeof r?e.E.encrypt(t,n,r,i):o.D.encrypt(t,n,r,i)},t.decrypt=function(n,r,i){return"string"==typeof r?e.E.decrypt(t,n,r,i):o.D.decrypt(t,n,r,i)},t.ivSize=4,t}(t.q)}(),i}()}));
\ No newline at end of file
... ...
  1 +import { Hasher, HasherProps } from "./lib/algorithm/Hasher";
  2 +import { Word32Array } from "./lib/Word32Array";
  3 +export interface SHA1Props extends HasherProps {
  4 + hash: Word32Array;
  5 +}
  6 +export declare class SHA1 extends Hasher {
  7 + protected _props?: Partial<SHA1Props>;
  8 + private _hash;
  9 + constructor(props?: SHA1Props);
  10 + protected _doReset(): void;
  11 + protected _doProcessBlock(words: number[], offset: number): void;
  12 + protected _doFinalize(): Word32Array;
  13 + clone(): SHA1;
  14 + static hash(message: Word32Array | string, props?: SHA1Props): Word32Array;
  15 +}
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var i in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[i]=r[i]}}(this,(function(){return function(){"use strict";var n={3354:function(n,t,r){r.d(t,{e:function(){return o}});var i=r(5720),e=r(9054),o=function(){function n(t,r){if(Array.isArray(t)||!t)return this.t=Array.isArray(t)?t:[],void(this.i="number"==typeof r?r:4*this.t.length);if(t instanceof n)return this.t=t.words.slice(),void(this.i=t.nSigBytes);var i;try{t instanceof ArrayBuffer?i=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!i)throw new Error("Invalid argument");for(var e=i.byteLength,o=[],u=0;u<e;u++)o[u>>>2]|=i[u]<<24-u%4*8;this.t=o,this.i=e}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.i},set:function(n){this.i=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.t},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):i.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.t,t=this.i,r=new Uint8Array(t),i=0;i<t;i++)r[i]=n[i>>>2]>>>24-i%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.i%4)for(var i=0;i<r;i++){var e=t[i>>>2]>>>24-i%4*8&255;this.t[this.i+i>>>2]|=e<<24-(this.i+i)%4*8}else for(i=0;i<r;i+=4)this.t[this.i+i>>>2]=t[i>>>2];return this.i+=r,this},n.prototype.clamp=function(){var n=this.i;this.t[n>>>2]&=4294967295<<32-n%4*8,this.t.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.t.slice(),this.i)},n.random=function(t){for(var r=[],i=0;i<t;i+=4)r.push((0,e.M)());return new n(r,t)},n}()},7211:function(n,t,r){r.d(t,{C:function(){return o}});var i=r(3354),e=r(4768),o=function(){function n(n){this.u=0,this.h=0,this.v=n,this.l=n&&void 0!==n.data?n.data.clone():new i.e,this.A=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.h},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.l=void 0!==n?n.clone():new i.e,this.A="number"==typeof t?t:0},n.prototype.j=function(n){var t="string"==typeof n?e.d.parse(n):n;this.l.concat(t),this.A+=t.nSigBytes},n.prototype.O=function(n){var t,r=this.l.words,e=this.l.nSigBytes,o=this.h,u=e/(4*this.h),f=(u=n?Math.ceil(u):Math.max((0|u)-this.u,0))*o,c=Math.min(4*f,e);if(f){for(var a=0;a<f;a+=o)this.I(r,a);t=r.splice(0,f),this.l.nSigBytes-=c}return new i.e(t,c)},n.prototype.I=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,r){r.d(t,{P:function(){return u}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.h=16,r.v=t,t&&"number"==typeof t.blockSize&&(r.h=t.blockSize),r.reset(t?t.data:void 0,t?t.nBytes:void 0),r}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.h},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.U()},t.prototype.update=function(n){return this.j(n),this.O(),this},t.prototype.finalize=function(n){return n&&this.j(n),this._()},t.prototype.U=function(){throw new Error("Not implemented")},t.prototype._=function(){throw new Error("Not implemented")},t}(e.C)},1756:function(n,t,r){r.d(t,{w:function(){return u}});var i,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(i=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(i)?(i=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(i)&&i):i);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},5720:function(n,t,r){r.d(t,{p:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],e=0;e<t;e+=2)r[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new i.e(r,t/2)}}},8702:function(n,t,r){r.d(t,{m:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(n){for(var t=n.length,r=[],e=0;e<t;e++)r[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new i.e(r,t)}}},4768:function(n,t,r){r.d(t,{d:function(){return e}});var i=r(8702),e={stringify:function(n){try{return decodeURIComponent(escape(i.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return i.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,r){r.d(t,{M:function(){return e}});var i=r(1756);var e=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,i.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function r(i){var e=t[i];if(void 0!==e)return e.exports;var o=t[i]={exports:{}};return n[i](o,o.exports,r),o.exports}r.d=function(n,t){for(var i in t)r.o(t,i)&&!r.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"S",{value:!0})};var i={};return function(){r.r(i),r.d(i,{SHA1:function(){return f}});var n,t=r(1868),e=r(3354),o=(n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(t,r)},function(t,r){function i(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}),u=[],f=function(n){function t(t){var r=n.call(this,t)||this;return r.N=new e.e([1732584193,4023233417,2562383102,271733878,3285377520]),r.v=t,t&&void 0!==t.hash&&(r.N=t.hash.clone()),r}return o(t,n),t.prototype.U=function(){this.N=new e.e([1732584193,4023233417,2562383102,271733878,3285377520])},t.prototype.I=function(n,t){for(var r=this.N.words,i=r[0],e=r[1],o=r[2],f=r[3],c=r[4],a=0;a<80;a++){if(a<16)u[a]=0|n[t+a];else{var s=u[a-3]^u[a-8]^u[a-14]^u[a-16];u[a]=s<<1|s>>>31}var h=(i<<5|i>>>27)+c+u[a];h+=a<20?1518500249+(e&o|~e&f):a<40?1859775393+(e^o^f):a<60?(e&o|e&f|o&f)-1894007588:(e^o^f)-899497514,c=f,f=o,o=e<<30|e>>>2,e=i,i=h}r[0]=r[0]+i|0,r[1]=r[1]+e|0,r[2]=r[2]+o|0,r[3]=r[3]+f|0,r[4]=r[4]+c|0},t.prototype._=function(){var n=this.l.words,t=8*this.A,r=8*this.l.nSigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=Math.floor(t/4294967296),n[15+(r+64>>>9<<4)]=t,this.l.nSigBytes=4*n.length,this.O(),this.N},t.prototype.clone=function(){return new t({hash:this.N,blockSize:this.h,data:this.l,nBytes:this.A})},t.hash=function(n,r){return new t(r).finalize(n)},t}(t.P)}(),i}()}));
\ No newline at end of file
... ...
  1 +import { Word32Array } from "./lib/Word32Array";
  2 +import { SHA256 } from "./SHA256";
  3 +import type { HasherProps } from "./lib/algorithm/Hasher";
  4 +export interface SHA224Props extends HasherProps {
  5 + hash: Word32Array;
  6 +}
  7 +export declare class SHA224 extends SHA256 {
  8 + protected _props?: Partial<SHA224Props>;
  9 + protected _hash: Word32Array;
  10 + constructor(props?: SHA224Props);
  11 + protected _doReset(): void;
  12 + protected _doFinalize(): Word32Array;
  13 + clone(): SHA224;
  14 + static hash(message: Word32Array | string, props?: SHA224Props): Word32Array;
  15 +}
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var i in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[i]=r[i]}}(this,(function(){return function(){"use strict";var n={5561:function(n,t,r){r.d(t,{SHA256:function(){return v}});var i,e=r(1868),o=r(3354),u=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),f=[],c=[];function a(n){for(var t=Math.sqrt(n),r=2;r<=t;r++)if(!(n%r))return!1;return!0}function s(n){return 4294967296*(n-(0|n))|0}!function(){for(var n=2,t=0;t<64;)a(n)&&(t<8&&(f[t]=s(Math.pow(n,.5))),c[t]=s(Math.pow(n,1/3)),t++),n++}();var h=[],v=function(n){function t(t){var r=n.call(this,t)||this;return r.t=new o.e(f.slice(0)),r.i=t,t&&void 0!==t.hash&&(r.t=t.hash.clone()),r}return u(t,n),t.prototype.u=function(){this.t=new o.e(f.slice(0))},t.prototype.h=function(n,t){for(var r=this.t.words,i=r[0],e=r[1],o=r[2],u=r[3],f=r[4],a=r[5],s=r[6],v=r[7],w=0;w<64;w++){if(w<16)h[w]=0|n[t+w];else{var d=h[w-15],l=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,y=h[w-2],b=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;h[w]=l+h[w-7]+b+h[w-16]}var p=i&e^i&o^e&o,m=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),g=v+((f<<26|f>>>6)^(f<<21|f>>>11)^(f<<7|f>>>25))+(f&a^~f&s)+c[w]+h[w];v=s,s=a,a=f,f=u+g|0,u=o,o=e,e=i,i=g+(m+p)|0}r[0]=r[0]+i|0,r[1]=r[1]+e|0,r[2]=r[2]+o|0,r[3]=r[3]+u|0,r[4]=r[4]+f|0,r[5]=r[5]+a|0,r[6]=r[6]+s|0,r[7]=r[7]+v|0},t.prototype.v=function(){var n=this.l.words,t=8*this.j,r=8*this.l.nSigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=Math.floor(t/4294967296),n[15+(r+64>>>9<<4)]=t,this.l.nSigBytes=4*n.length,this.A(),this.t},t.prototype.clone=function(){return new t({hash:this.t,blockSize:this.O,data:this.l,nBytes:this.j})},t.hash=function(n,r){return new t(r).finalize(n)},t}(e.P)},3354:function(n,t,r){r.d(t,{e:function(){return o}});var i=r(5720),e=r(9054),o=function(){function n(t,r){if(Array.isArray(t)||!t)return this._=Array.isArray(t)?t:[],void(this.I="number"==typeof r?r:4*this._.length);if(t instanceof n)return this._=t.words.slice(),void(this.I=t.nSigBytes);var i;try{t instanceof ArrayBuffer?i=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!i)throw new Error("Invalid argument");for(var e=i.byteLength,o=[],u=0;u<e;u++)o[u>>>2]|=i[u]<<24-u%4*8;this._=o,this.I=e}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.I},set:function(n){this.I=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this._},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):i.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this._,t=this.I,r=new Uint8Array(t),i=0;i<t;i++)r[i]=n[i>>>2]>>>24-i%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.I%4)for(var i=0;i<r;i++){var e=t[i>>>2]>>>24-i%4*8&255;this._[this.I+i>>>2]|=e<<24-(this.I+i)%4*8}else for(i=0;i<r;i+=4)this._[this.I+i>>>2]=t[i>>>2];return this.I+=r,this},n.prototype.clamp=function(){var n=this.I;this._[n>>>2]&=4294967295<<32-n%4*8,this._.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this._.slice(),this.I)},n.random=function(t){for(var r=[],i=0;i<t;i+=4)r.push((0,e.M)());return new n(r,t)},n}()},7211:function(n,t,r){r.d(t,{C:function(){return o}});var i=r(3354),e=r(4768),o=function(){function n(n){this.S=0,this.O=0,this.i=n,this.l=n&&void 0!==n.data?n.data.clone():new i.e,this.j=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.O},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.l=void 0!==n?n.clone():new i.e,this.j="number"==typeof t?t:0},n.prototype.U=function(n){var t="string"==typeof n?e.d.parse(n):n;this.l.concat(t),this.j+=t.nSigBytes},n.prototype.A=function(n){var t,r=this.l.words,e=this.l.nSigBytes,o=this.O,u=e/(4*this.O),f=(u=n?Math.ceil(u):Math.max((0|u)-this.S,0))*o,c=Math.min(4*f,e);if(f){for(var a=0;a<f;a+=o)this.h(r,a);t=r.splice(0,f),this.l.nSigBytes-=c}return new i.e(t,c)},n.prototype.h=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,r){r.d(t,{P:function(){return u}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.O=16,r.i=t,t&&"number"==typeof t.blockSize&&(r.O=t.blockSize),r.reset(t?t.data:void 0,t?t.nBytes:void 0),r}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.O},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.u()},t.prototype.update=function(n){return this.U(n),this.A(),this},t.prototype.finalize=function(n){return n&&this.U(n),this.v()},t.prototype.u=function(){throw new Error("Not implemented")},t.prototype.v=function(){throw new Error("Not implemented")},t}(e.C)},1756:function(n,t,r){r.d(t,{w:function(){return u}});var i,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(i=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(i)?(i=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(i)&&i):i);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},5720:function(n,t,r){r.d(t,{p:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],e=0;e<t;e+=2)r[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new i.e(r,t/2)}}},8702:function(n,t,r){r.d(t,{m:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(n){for(var t=n.length,r=[],e=0;e<t;e++)r[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new i.e(r,t)}}},4768:function(n,t,r){r.d(t,{d:function(){return e}});var i=r(8702),e={stringify:function(n){try{return decodeURIComponent(escape(i.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return i.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,r){r.d(t,{M:function(){return e}});var i=r(1756);var e=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,i.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function r(i){var e=t[i];if(void 0!==e)return e.exports;var o=t[i]={exports:{}};return n[i](o,o.exports,r),o.exports}r.d=function(n,t){for(var i in t)r.o(t,i)&&!r.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"N",{value:!0})};var i={};return function(){r.r(i),r.d(i,{SHA224:function(){return u}});var n,t=r(3354),e=r(5561),o=(n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(t,r)},function(t,r){function i(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}),u=function(n){function r(r){var i=n.call(this,r)||this;return i.t=new t.e([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),i.i=r,r&&void 0!==r.hash&&(i.t=r.hash.clone()),i}return o(r,n),r.prototype.u=function(){this.t=new t.e([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},r.prototype.v=function(){var t=n.prototype.v.call(this);return t.nSigBytes-=4,t},r.prototype.clone=function(){return new r({hash:this.t,blockSize:this.O,data:this.l,nBytes:this.j})},r.hash=function(n,t){return new r(t).finalize(n)},r}(e.SHA256)}(),i}()}));
\ No newline at end of file
... ...
  1 +import { Hasher, HasherProps } from "./lib/algorithm/Hasher";
  2 +import { Word32Array } from "./lib/Word32Array";
  3 +export interface SHA256Props extends HasherProps {
  4 + hash: Word32Array;
  5 +}
  6 +export declare class SHA256 extends Hasher {
  7 + protected _props?: Partial<SHA256Props>;
  8 + protected _hash: Word32Array;
  9 + constructor(props?: SHA256Props);
  10 + protected _doReset(): void;
  11 + protected _doProcessBlock(words: number[], offset: number): void;
  12 + protected _doFinalize(): Word32Array;
  13 + clone(): SHA256;
  14 + static hash(message: Word32Array | string, props?: SHA256Props): Word32Array;
  15 +}
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var i in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[i]=r[i]}}(this,(function(){return function(){"use strict";var n={3354:function(n,t,r){r.d(t,{e:function(){return o}});var i=r(5720),e=r(9054),o=function(){function n(t,r){if(Array.isArray(t)||!t)return this.t=Array.isArray(t)?t:[],void(this.i="number"==typeof r?r:4*this.t.length);if(t instanceof n)return this.t=t.words.slice(),void(this.i=t.nSigBytes);var i;try{t instanceof ArrayBuffer?i=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!i)throw new Error("Invalid argument");for(var e=i.byteLength,o=[],u=0;u<e;u++)o[u>>>2]|=i[u]<<24-u%4*8;this.t=o,this.i=e}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.i},set:function(n){this.i=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.t},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):i.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.t,t=this.i,r=new Uint8Array(t),i=0;i<t;i++)r[i]=n[i>>>2]>>>24-i%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.i%4)for(var i=0;i<r;i++){var e=t[i>>>2]>>>24-i%4*8&255;this.t[this.i+i>>>2]|=e<<24-(this.i+i)%4*8}else for(i=0;i<r;i+=4)this.t[this.i+i>>>2]=t[i>>>2];return this.i+=r,this},n.prototype.clamp=function(){var n=this.i;this.t[n>>>2]&=4294967295<<32-n%4*8,this.t.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.t.slice(),this.i)},n.random=function(t){for(var r=[],i=0;i<t;i+=4)r.push((0,e.M)());return new n(r,t)},n}()},7211:function(n,t,r){r.d(t,{C:function(){return o}});var i=r(3354),e=r(4768),o=function(){function n(n){this.u=0,this.h=0,this.v=n,this.l=n&&void 0!==n.data?n.data.clone():new i.e,this.A=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.h},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.l=void 0!==n?n.clone():new i.e,this.A="number"==typeof t?t:0},n.prototype.j=function(n){var t="string"==typeof n?e.d.parse(n):n;this.l.concat(t),this.A+=t.nSigBytes},n.prototype.O=function(n){var t,r=this.l.words,e=this.l.nSigBytes,o=this.h,u=e/(4*this.h),f=(u=n?Math.ceil(u):Math.max((0|u)-this.u,0))*o,c=Math.min(4*f,e);if(f){for(var a=0;a<f;a+=o)this.I(r,a);t=r.splice(0,f),this.l.nSigBytes-=c}return new i.e(t,c)},n.prototype.I=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,r){r.d(t,{P:function(){return u}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.h=16,r.v=t,t&&"number"==typeof t.blockSize&&(r.h=t.blockSize),r.reset(t?t.data:void 0,t?t.nBytes:void 0),r}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.h},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.U()},t.prototype.update=function(n){return this.j(n),this.O(),this},t.prototype.finalize=function(n){return n&&this.j(n),this._()},t.prototype.U=function(){throw new Error("Not implemented")},t.prototype._=function(){throw new Error("Not implemented")},t}(e.C)},1756:function(n,t,r){r.d(t,{w:function(){return u}});var i,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(i=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(i)?(i=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(i)&&i):i);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},5720:function(n,t,r){r.d(t,{p:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],e=0;e<t;e+=2)r[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new i.e(r,t/2)}}},8702:function(n,t,r){r.d(t,{m:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(n){for(var t=n.length,r=[],e=0;e<t;e++)r[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new i.e(r,t)}}},4768:function(n,t,r){r.d(t,{d:function(){return e}});var i=r(8702),e={stringify:function(n){try{return decodeURIComponent(escape(i.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return i.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,r){r.d(t,{M:function(){return e}});var i=r(1756);var e=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,i.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function r(i){var e=t[i];if(void 0!==e)return e.exports;var o=t[i]={exports:{}};return n[i](o,o.exports,r),o.exports}r.d=function(n,t){for(var i in t)r.o(t,i)&&!r.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"S",{value:!0})};var i={};return function(){r.r(i),r.d(i,{SHA256:function(){return h}});var n,t=r(1868),e=r(3354),o=(n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(t,r)},function(t,r){function i(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}),u=[],f=[];function c(n){for(var t=Math.sqrt(n),r=2;r<=t;r++)if(!(n%r))return!1;return!0}function a(n){return 4294967296*(n-(0|n))|0}!function(){for(var n=2,t=0;t<64;)c(n)&&(t<8&&(u[t]=a(Math.pow(n,.5))),f[t]=a(Math.pow(n,1/3)),t++),n++}();var s=[],h=function(n){function t(t){var r=n.call(this,t)||this;return r.N=new e.e(u.slice(0)),r.v=t,t&&void 0!==t.hash&&(r.N=t.hash.clone()),r}return o(t,n),t.prototype.U=function(){this.N=new e.e(u.slice(0))},t.prototype.I=function(n,t){for(var r=this.N.words,i=r[0],e=r[1],o=r[2],u=r[3],c=r[4],a=r[5],h=r[6],v=r[7],d=0;d<64;d++){if(d<16)s[d]=0|n[t+d];else{var w=s[d-15],l=(w<<25|w>>>7)^(w<<14|w>>>18)^w>>>3,y=s[d-2],b=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;s[d]=l+s[d-7]+b+s[d-16]}var p=i&e^i&o^e&o,m=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),g=v+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&a^~c&h)+f[d]+s[d];v=h,h=a,a=c,c=u+g|0,u=o,o=e,e=i,i=g+(m+p)|0}r[0]=r[0]+i|0,r[1]=r[1]+e|0,r[2]=r[2]+o|0,r[3]=r[3]+u|0,r[4]=r[4]+c|0,r[5]=r[5]+a|0,r[6]=r[6]+h|0,r[7]=r[7]+v|0},t.prototype._=function(){var n=this.l.words,t=8*this.A,r=8*this.l.nSigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=Math.floor(t/4294967296),n[15+(r+64>>>9<<4)]=t,this.l.nSigBytes=4*n.length,this.O(),this.N},t.prototype.clone=function(){return new t({hash:this.N,blockSize:this.h,data:this.l,nBytes:this.A})},t.hash=function(n,r){return new t(r).finalize(n)},t}(t.P)}(),i}()}));
\ No newline at end of file
... ...
  1 +import { Word64 } from "./lib/Word64Array";
  2 +import { Hasher, HasherProps } from "./lib/algorithm/Hasher";
  3 +import { Word32Array } from "./lib/Word32Array";
  4 +export interface SHA3Props extends HasherProps {
  5 + state: Word64[];
  6 + outputLength: number;
  7 +}
  8 +export declare class SHA3 extends Hasher {
  9 + protected _props?: Partial<SHA3Props>;
  10 + protected _blockSize: number;
  11 + protected _state: Word64[];
  12 + protected _outputLength: number;
  13 + constructor(props?: Partial<SHA3Props>);
  14 + protected _doReset(): void;
  15 + protected _doProcessBlock(words: number[], offset: number): void;
  16 + protected _doFinalize(): Word32Array;
  17 + clone(): SHA3;
  18 + static hash(message: Word32Array | string, props?: SHA3Props): Word32Array;
  19 +}
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var i in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[i]=r[i]}}(this,(function(){return function(){"use strict";var n={3354:function(n,t,r){r.d(t,{e:function(){return o}});var i=r(5720),e=r(9054),o=function(){function n(t,r){if(Array.isArray(t)||!t)return this.t=Array.isArray(t)?t:[],void(this.i="number"==typeof r?r:4*this.t.length);if(t instanceof n)return this.t=t.words.slice(),void(this.i=t.nSigBytes);var i;try{t instanceof ArrayBuffer?i=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!i)throw new Error("Invalid argument");for(var e=i.byteLength,o=[],u=0;u<e;u++)o[u>>>2]|=i[u]<<24-u%4*8;this.t=o,this.i=e}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.i},set:function(n){this.i=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.t},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):i.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.t,t=this.i,r=new Uint8Array(t),i=0;i<t;i++)r[i]=n[i>>>2]>>>24-i%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.i%4)for(var i=0;i<r;i++){var e=t[i>>>2]>>>24-i%4*8&255;this.t[this.i+i>>>2]|=e<<24-(this.i+i)%4*8}else for(i=0;i<r;i+=4)this.t[this.i+i>>>2]=t[i>>>2];return this.i+=r,this},n.prototype.clamp=function(){var n=this.i;this.t[n>>>2]&=4294967295<<32-n%4*8,this.t.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.t.slice(),this.i)},n.random=function(t){for(var r=[],i=0;i<t;i+=4)r.push((0,e.M)());return new n(r,t)},n}()},6957:function(n,t,r){r.d(t,{r:function(){return o}});var i=r(5720),e=r(3354),o=function(){function n(n,t){this.high=n,this.low=t}return n.prototype.clone=function(){return new n(this.high,this.low)},n}();!function(){function n(n,t){this.t=n||[],this.i="number"==typeof t?t:8*this.t.length}Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.i},set:function(n){this.i=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.t},enumerable:!1,configurable:!0}),n.prototype.to32=function(){for(var n=[],t=0;t<this.t.length;t++){var r=this.t[t];n.push(r.high),n.push(r.low)}return new e.e(n,this.i)},n.prototype.toString=function(n){return n?n.stringify(this.to32()):i.p.stringify(this.to32())},n.prototype.clone=function(){for(var t=this.t.slice(),r=0;r<t.length;r++)t[r]=t[r].clone();return new n(t,this.i)}}()},7211:function(n,t,r){r.d(t,{C:function(){return o}});var i=r(3354),e=r(4768),o=function(){function n(n){this.u=0,this.h=0,this.v=n,this.l=n&&void 0!==n.data?n.data.clone():new i.e,this.j=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.h},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.l=void 0!==n?n.clone():new i.e,this.j="number"==typeof t?t:0},n.prototype.A=function(n){var t="string"==typeof n?e.d.parse(n):n;this.l.concat(t),this.j+=t.nSigBytes},n.prototype.O=function(n){var t,r=this.l.words,e=this.l.nSigBytes,o=this.h,u=e/(4*this.h),f=(u=n?Math.ceil(u):Math.max((0|u)-this.u,0))*o,a=Math.min(4*f,e);if(f){for(var c=0;c<f;c+=o)this.I(r,c);t=r.splice(0,f),this.l.nSigBytes-=a}return new i.e(t,a)},n.prototype.I=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,r){r.d(t,{P:function(){return u}});var i,e=r(7211),o=(i=function(n,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(n,t)},function(n,t){function r(){this.constructor=n}i(n,t),n.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),u=function(n){function t(t){var r=n.call(this,t)||this;return r.h=16,r.v=t,t&&"number"==typeof t.blockSize&&(r.h=t.blockSize),r.reset(t?t.data:void 0,t?t.nBytes:void 0),r}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.h},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,r){n.prototype.reset.call(this,t,r),this.U()},t.prototype.update=function(n){return this.A(n),this.O(),this},t.prototype.finalize=function(n){return n&&this.A(n),this.S()},t.prototype.U=function(){throw new Error("Not implemented")},t.prototype.S=function(){throw new Error("Not implemented")},t}(e.C)},1756:function(n,t,r){r.d(t,{w:function(){return u}});var i,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(i=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(i)?(i=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(i)&&i):i);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},5720:function(n,t,r){r.d(t,{p:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],e=0;e<t;e+=2)r[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new i.e(r,t/2)}}},8702:function(n,t,r){r.d(t,{m:function(){return e}});var i=r(3354),e={stringify:function(n){for(var t=n.nSigBytes,r=n.words,i=[],e=0;e<t;e++){var o=r[e>>>2]>>>24-e%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(n){for(var t=n.length,r=[],e=0;e<t;e++)r[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new i.e(r,t)}}},4768:function(n,t,r){r.d(t,{d:function(){return e}});var i=r(8702),e={stringify:function(n){try{return decodeURIComponent(escape(i.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return i.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,r){r.d(t,{M:function(){return e}});var i=r(1756);var e=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,i.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==r.g&&r.g.crypto?function(){return r.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function r(i){var e=t[i];if(void 0!==e)return e.exports;var o=t[i]={exports:{}};return n[i](o,o.exports,r),o.exports}r.d=function(n,t){for(var i in t)r.o(t,i)&&!r.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"_",{value:!0})};var i={};return function(){r.r(i),r.d(i,{SHA3:function(){return h}});var n,t=r(6957),e=r(1868),o=r(3354),u=(n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])})(t,r)},function(t,r){function i(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}),f=[],a=[],c=[];!function(){for(var n=1,r=0,i=0;i<24;i++){f[n+5*r]=(i+1)*(i+2)/2%64;var e=(2*n+3*r)%5;n=r%5,r=e}for(var o=0;o<5;o++)for(var u=0;u<5;u++)a[o+5*u]=u+(2*o+3*u)%5*5;for(var s=1,h=0;h<24;h++){for(var v=0,w=0,d=0;d<7;d++){if(1&s){var l=(1<<d)-1;l<32?w^=1<<l:v^=1<<l-32}128&s?s=s<<1^113:s<<=1}c[h]=new t.r(v,w)}}();var s=[];!function(){for(var n=0;n<25;n++)s[n]=new t.r(0,0)}();var h=function(n){function r(r){var i=n.call(this,r)||this;if(i.h=32,i.N=[],i.F=512,i.v=r,r){if(void 0!==r.outputLength){if(![224,256,384,512].includes(r.outputLength))throw new Error("Unsupported output length.");i.F=r.outputLength}void 0!==r.state&&(i.N=r.state.map((function(n){return n.clone()})))}if(0===i.N.length)for(var e=0;e<25;e++)i.N[e]=new t.r(0,0);return i.h=(1600-2*i.F)/32,i}return u(r,n),r.prototype.U=function(){this.N=[];for(var n=0;n<25;n++)this.N[n]=new t.r(0,0);this.h=(1600-2*this.F)/32},r.prototype.I=function(n,t){for(var r=this.N,i=this.h/2,e=0;e<i;e++){var o=n[t+2*e],u=n[t+2*e+1];o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8),r[e].high^=u,r[e].low^=o}for(var h=0;h<24;h++){for(var v=0;v<5;v++){for(var w=0,d=0,l=0;l<5;l++){w^=(S=r[v+5*l]).high,d^=S.low}var b=s[v];b.high=w,b.low=d}for(v=0;v<5;v++){var y=s[(v+4)%5],p=s[(v+1)%5],m=p.high,g=p.low;for(w=y.high^(m<<1|g>>>31),d=y.low^(g<<1|m>>>31),l=0;l<5;l++){(S=r[v+5*l]).high^=w,S.low^=d}}for(var j=1;j<25;j++){w=void 0,d=void 0;var A=r[j].high,O=r[j].low,I=f[j];I<32?(w=A<<I|O>>>32-I,d=O<<I|A>>>32-I):(w=O<<I-32|A>>>64-I,d=A<<I-32|O>>>64-I);var E=s[a[j]];E.high=w,E.low=d}var U=s[0],M=r[0];U.high=M.high,U.low=M.low;for(v=0;v<5;v++)for(l=0;l<5;l++){var S=r[j=v+5*l],_=s[j],N=s[(v+1)%5+5*l],x=s[(v+2)%5+5*l];S.high=_.high^~N.high&x.high,S.low=_.low^~N.low&x.low}var C=r[0],F=c[h];C.high^=F.high,C.low^=F.low}},r.prototype.S=function(){var n=this.l,t=n.words,r=8*n.nSigBytes,i=32*this.blockSize;t[r>>>5]|=1<<24-r%32,t[(Math.ceil((r+1)/i)*i>>>5)-1]|=128,n.nSigBytes=4*t.length,this.O();for(var e=this.N,u=this.F/8,f=u/8,a=[],c=0;c<f;c++){var s=e[c],h=s.high,v=s.low;h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),v=16711935&(v<<8|v>>>24)|4278255360&(v<<24|v>>>8),a.push(v),a.push(h)}return new o.e(a,u)},r.prototype.clone=function(){return new r({outputLength:this.F,state:this.N,blockSize:this.h,data:this.l,nBytes:this.j})},r.hash=function(n,t){return new r(t).finalize(n)},r}(e.P)}(),i}()}));
\ No newline at end of file
... ...
  1 +import { Word64Array } from "./lib/Word64Array";
  2 +import { SHA512 } from "./SHA512";
  3 +import type { HasherProps } from "./lib/algorithm/Hasher";
  4 +import type { Word32Array } from "./lib/Word32Array";
  5 +export interface SHA384Props extends HasherProps {
  6 + hash: Word64Array;
  7 +}
  8 +export declare class SHA384 extends SHA512 {
  9 + protected _props?: Partial<SHA384Props>;
  10 + protected _hash: Word64Array;
  11 + constructor(props?: Partial<SHA384Props>);
  12 + protected _doReset(): void;
  13 + protected _doFinalize(): Word32Array;
  14 + clone(): SHA384;
  15 + static hash(message: Word32Array | string, props?: SHA384Props): Word32Array;
  16 +}
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var e=t();for(var r in n.JsCrypto=n.JsCrypto||{},e)n.JsCrypto[r]=e[r]}}(this,(function(){return function(){"use strict";var n={7491:function(n,t,e){e.d(t,{SHA512:function(){return w}});var r,i=e(1868),o=e(6957),u=(r=function(n,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])})(n,t)},function(n,t){function e(){this.constructor=n}r(n,t),n.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),f=[new o.r(1116352408,3609767458),new o.r(1899447441,602891725),new o.r(3049323471,3964484399),new o.r(3921009573,2173295548),new o.r(961987163,4081628472),new o.r(1508970993,3053834265),new o.r(2453635748,2937671579),new o.r(2870763221,3664609560),new o.r(3624381080,2734883394),new o.r(310598401,1164996542),new o.r(607225278,1323610764),new o.r(1426881987,3590304994),new o.r(1925078388,4068182383),new o.r(2162078206,991336113),new o.r(2614888103,633803317),new o.r(3248222580,3479774868),new o.r(3835390401,2666613458),new o.r(4022224774,944711139),new o.r(264347078,2341262773),new o.r(604807628,2007800933),new o.r(770255983,1495990901),new o.r(1249150122,1856431235),new o.r(1555081692,3175218132),new o.r(1996064986,2198950837),new o.r(2554220882,3999719339),new o.r(2821834349,766784016),new o.r(2952996808,2566594879),new o.r(3210313671,3203337956),new o.r(3336571891,1034457026),new o.r(3584528711,2466948901),new o.r(113926993,3758326383),new o.r(338241895,168717936),new o.r(666307205,1188179964),new o.r(773529912,1546045734),new o.r(1294757372,1522805485),new o.r(1396182291,2643833823),new o.r(1695183700,2343527390),new o.r(1986661051,1014477480),new o.r(2177026350,1206759142),new o.r(2456956037,344077627),new o.r(2730485921,1290863460),new o.r(2820302411,3158454273),new o.r(3259730800,3505952657),new o.r(3345764771,106217008),new o.r(3516065817,3606008344),new o.r(3600352804,1432725776),new o.r(4094571909,1467031594),new o.r(275423344,851169720),new o.r(430227734,3100823752),new o.r(506948616,1363258195),new o.r(659060556,3750685593),new o.r(883997877,3785050280),new o.r(958139571,3318307427),new o.r(1322822218,3812723403),new o.r(1537002063,2003034995),new o.r(1747873779,3602036899),new o.r(1955562222,1575990012),new o.r(2024104815,1125592928),new o.r(2227730452,2716904306),new o.r(2361852424,442776044),new o.r(2428436474,593698344),new o.r(2756734187,3733110249),new o.r(3204031479,2999351573),new o.r(3329325298,3815920427),new o.r(3391569614,3928383900),new o.r(3515267271,566280711),new o.r(3940187606,3454069534),new o.r(4118630271,4000239992),new o.r(116418474,1914138554),new o.r(174292421,2731055270),new o.r(289380356,3203993006),new o.r(460393269,320620315),new o.r(685471733,587496836),new o.r(852142971,1086792851),new o.r(1017036298,365543100),new o.r(1126000580,2618297676),new o.r(1288033470,3409855158),new o.r(1501505948,4234509866),new o.r(1607167915,987167468),new o.r(1816402316,1246189591)],c=[];!function(){for(var n=0;n<80;n++)c[n]=new o.r(0,0)}();var w=function(n){function t(t){var e=n.call(this,t)||this;return e.t=32,e.i=new o.m([new o.r(1779033703,4089235720),new o.r(3144134277,2227873595),new o.r(1013904242,4271175723),new o.r(2773480762,1595750129),new o.r(1359893119,2917565137),new o.r(2600822924,725511199),new o.r(528734635,4215389547),new o.r(1541459225,327033209)]),e.u=t,t&&void 0!==t.hash&&(e.i=t.hash.clone()),e}return u(t,n),t.prototype.h=function(){this.i=new o.m([new o.r(1779033703,4089235720),new o.r(3144134277,2227873595),new o.r(1013904242,4271175723),new o.r(2773480762,1595750129),new o.r(1359893119,2917565137),new o.r(2600822924,725511199),new o.r(528734635,4215389547),new o.r(1541459225,327033209)])},t.prototype.v=function(n,t){for(var e=this.i.words,r=e[0],i=e[1],o=e[2],u=e[3],w=e[4],s=e[5],a=e[6],h=e[7],v=r.high,d=r.low,l=i.high,b=i.low,y=o.high,p=o.low,m=u.high,g=u.low,j=w.high,A=w.low,O=s.high,_=s.low,I=a.high,S=a.low,E=h.high,M=h.low,U=v,N=d,x=l,B=b,C=y,F=p,k=m,z=g,H=j,T=A,P=O,R=_,q=I,$=S,D=E,G=M,J=0;J<80;J++){var K=void 0,L=void 0,Q=c[J];if(J<16)L=Q.high=0|n[t+2*J],K=Q.low=0|n[t+2*J+1];else{var V=c[J-15],W=V.high,X=V.low,Y=(W>>>1|X<<31)^(W>>>8|X<<24)^W>>>7,Z=(X>>>1|W<<31)^(X>>>8|W<<24)^(X>>>7|W<<25),nn=c[J-2],tn=nn.high,en=nn.low,rn=(tn>>>19|en<<13)^(tn<<3|en>>>29)^tn>>>6,on=(en>>>19|tn<<13)^(en<<3|tn>>>29)^(en>>>6|tn<<26),un=c[J-7],fn=un.high,cn=un.low,wn=c[J-16],sn=wn.high,an=wn.low;L=(L=(L=Y+fn+((K=Z+cn)>>>0<Z>>>0?1:0))+rn+((K+=on)>>>0<on>>>0?1:0))+sn+((K+=an)>>>0<an>>>0?1:0),Q.high=L,Q.low=K}var hn=H&P^~H&q,vn=T&R^~T&$,dn=U&x^U&C^x&C,ln=N&B^N&F^B&F,bn=(U>>>28|N<<4)^(U<<30|N>>>2)^(U<<25|N>>>7),yn=(N>>>28|U<<4)^(N<<30|U>>>2)^(N<<25|U>>>7),pn=(H>>>14|T<<18)^(H>>>18|T<<14)^(H<<23|T>>>9),mn=(T>>>14|H<<18)^(T>>>18|H<<14)^(T<<23|H>>>9),gn=f[J],jn=gn.high,An=gn.low,On=G+mn,_n=D+pn+(On>>>0<G>>>0?1:0),In=yn+ln;D=q,G=$,q=P,$=R,P=H,R=T,H=k+(_n=(_n=(_n=_n+hn+((On+=vn)>>>0<vn>>>0?1:0))+jn+((On+=An)>>>0<An>>>0?1:0))+L+((On+=K)>>>0<K>>>0?1:0))+((T=z+On|0)>>>0<z>>>0?1:0)|0,k=C,z=F,C=x,F=B,x=U,B=N,U=_n+(bn+dn+(In>>>0<yn>>>0?1:0))+((N=On+In|0)>>>0<On>>>0?1:0)|0}d=r.low=d+N,r.high=v+U+(d>>>0<N>>>0?1:0),b=i.low=b+B,i.high=l+x+(b>>>0<B>>>0?1:0),p=o.low=p+F,o.high=y+C+(p>>>0<F>>>0?1:0),g=u.low=g+z,u.high=m+k+(g>>>0<z>>>0?1:0),A=w.low=A+T,w.high=j+H+(A>>>0<T>>>0?1:0),_=s.low=_+R,s.high=O+P+(_>>>0<R>>>0?1:0),S=a.low=S+$,a.high=I+q+(S>>>0<$>>>0?1:0),M=h.low=M+G,h.high=E+D+(M>>>0<G>>>0?1:0)},t.prototype.l=function(){var n=this.j,t=n.words,e=8*this.A,r=8*n.nSigBytes;return t[r>>>5]|=128<<24-r%32,t[30+(r+128>>>10<<5)]=Math.floor(e/4294967296),t[31+(r+128>>>10<<5)]=e,n.nSigBytes=4*t.length,this.O(),this.i.to32()},t.prototype.clone=function(){return new t({hash:this.i,blockSize:this.t,data:this.j,nBytes:this.A})},t.hash=function(n,e){return new t(e).finalize(n)},t}(i.P)},3354:function(n,t,e){e.d(t,{e:function(){return o}});var r=e(5720),i=e(9054),o=function(){function n(t,e){if(Array.isArray(t)||!t)return this._=Array.isArray(t)?t:[],void(this.I="number"==typeof e?e:4*this._.length);if(t instanceof n)return this._=t.words.slice(),void(this.I=t.nSigBytes);var r;try{t instanceof ArrayBuffer?r=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!r)throw new Error("Invalid argument");for(var i=r.byteLength,o=[],u=0;u<i;u++)o[u>>>2]|=r[u]<<24-u%4*8;this._=o,this.I=i}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.I},set:function(n){this.I=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this._},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):r.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this._,t=this.I,e=new Uint8Array(t),r=0;r<t;r++)e[r]=n[r>>>2]>>>24-r%4*8&255;return e},n.prototype.concat=function(n){var t=n.words.slice(),e=n.nSigBytes;if(this.clamp(),this.I%4)for(var r=0;r<e;r++){var i=t[r>>>2]>>>24-r%4*8&255;this._[this.I+r>>>2]|=i<<24-(this.I+r)%4*8}else for(r=0;r<e;r+=4)this._[this.I+r>>>2]=t[r>>>2];return this.I+=e,this},n.prototype.clamp=function(){var n=this.I;this._[n>>>2]&=4294967295<<32-n%4*8,this._.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this._.slice(),this.I)},n.random=function(t){for(var e=[],r=0;r<t;r+=4)e.push((0,i.M)());return new n(e,t)},n}()},6957:function(n,t,e){e.d(t,{r:function(){return o},m:function(){return u}});var r=e(5720),i=e(3354),o=function(){function n(n,t){this.high=n,this.low=t}return n.prototype.clone=function(){return new n(this.high,this.low)},n}(),u=function(){function n(n,t){this._=n||[],this.I="number"==typeof t?t:8*this._.length}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.I},set:function(n){this.I=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this._},enumerable:!1,configurable:!0}),n.prototype.to32=function(){for(var n=[],t=0;t<this._.length;t++){var e=this._[t];n.push(e.high),n.push(e.low)}return new i.e(n,this.I)},n.prototype.toString=function(n){return n?n.stringify(this.to32()):r.p.stringify(this.to32())},n.prototype.clone=function(){for(var t=this._.slice(),e=0;e<t.length;e++)t[e]=t[e].clone();return new n(t,this.I)},n}()},7211:function(n,t,e){e.d(t,{C:function(){return o}});var r=e(3354),i=e(4768),o=function(){function n(n){this.S=0,this.t=0,this.u=n,this.j=n&&void 0!==n.data?n.data.clone():new r.e,this.A=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.t},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.j=void 0!==n?n.clone():new r.e,this.A="number"==typeof t?t:0},n.prototype.U=function(n){var t="string"==typeof n?i.d.parse(n):n;this.j.concat(t),this.A+=t.nSigBytes},n.prototype.O=function(n){var t,e=this.j.words,i=this.j.nSigBytes,o=this.t,u=i/(4*this.t),f=(u=n?Math.ceil(u):Math.max((0|u)-this.S,0))*o,c=Math.min(4*f,i);if(f){for(var w=0;w<f;w+=o)this.v(e,w);t=e.splice(0,f),this.j.nSigBytes-=c}return new r.e(t,c)},n.prototype.v=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,e){e.d(t,{P:function(){return u}});var r,i=e(7211),o=(r=function(n,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])})(n,t)},function(n,t){function e(){this.constructor=n}r(n,t),n.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),u=function(n){function t(t){var e=n.call(this,t)||this;return e.t=16,e.u=t,t&&"number"==typeof t.blockSize&&(e.t=t.blockSize),e.reset(t?t.data:void 0,t?t.nBytes:void 0),e}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.t},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,e){n.prototype.reset.call(this,t,e),this.h()},t.prototype.update=function(n){return this.U(n),this.O(),this},t.prototype.finalize=function(n){return n&&this.U(n),this.l()},t.prototype.h=function(){throw new Error("Not implemented")},t.prototype.l=function(){throw new Error("Not implemented")},t}(i.C)},1756:function(n,t,e){e.d(t,{w:function(){return u}});var r,i="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(r=parseInt((/msie (\d+)/.exec(i)||[])[1],10),isNaN(r)?(r=parseInt((/trident\/.*; rv:(\d+)/.exec(i)||[])[1],10),!isNaN(r)&&r):r);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},5720:function(n,t,e){e.d(t,{p:function(){return i}});var r=e(3354),i={stringify:function(n){for(var t=n.nSigBytes,e=n.words,r=[],i=0;i<t;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var e=[],i=0;i<t;i+=2)e[i>>>3]|=parseInt(n.substr(i,2),16)<<24-i%8*4;return new r.e(e,t/2)}}},8702:function(n,t,e){e.d(t,{m:function(){return i}});var r=e(3354),i={stringify:function(n){for(var t=n.nSigBytes,e=n.words,r=[],i=0;i<t;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(n){for(var t=n.length,e=[],i=0;i<t;i++)e[i>>>2]|=(255&n.charCodeAt(i))<<24-i%4*8;return new r.e(e,t)}}},4768:function(n,t,e){e.d(t,{d:function(){return i}});var r=e(8702),i={stringify:function(n){try{return decodeURIComponent(escape(r.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return r.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,e){e.d(t,{M:function(){return i}});var r=e(1756);var i=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,r.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==e.g&&e.g.crypto?function(){return e.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function e(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return n[r](o,o.exports,e),o.exports}e.d=function(n,t){for(var r in t)e.o(t,r)&&!e.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:t[r]})},e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),e.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},e.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"N",{value:!0})};var r={};return function(){e.r(r),e.d(r,{SHA384:function(){return u}});var n,t=e(6957),i=e(7491),o=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),u=function(n){function e(e){var r=n.call(this,e)||this;return r.i=new t.m([new t.r(3418070365,3238371032),new t.r(1654270250,914150663),new t.r(2438529370,812702999),new t.r(355462360,4144912697),new t.r(1731405415,4290775857),new t.r(2394180231,1750603025),new t.r(3675008525,1694076839),new t.r(1203062813,3204075428)]),r.u=e,e&&void 0!==e.hash&&(r.i=e.hash.clone()),r}return o(e,n),e.prototype.h=function(){this.i=new t.m([new t.r(3418070365,3238371032),new t.r(1654270250,914150663),new t.r(2438529370,812702999),new t.r(355462360,4144912697),new t.r(1731405415,4290775857),new t.r(2394180231,1750603025),new t.r(3675008525,1694076839),new t.r(1203062813,3204075428)])},e.prototype.l=function(){var t=n.prototype.l.call(this);return t.nSigBytes-=16,t},e.prototype.clone=function(){return new e({hash:this.i,blockSize:this.t,data:this.j,nBytes:this.A})},e.hash=function(n,t){return new e(t).finalize(n)},e}(i.SHA512)}(),r}()}));
\ No newline at end of file
... ...
  1 +import { Hasher, HasherProps } from "./lib/algorithm/Hasher";
  2 +import { Word64Array } from "./lib/Word64Array";
  3 +import type { Word32Array } from "./lib/Word32Array";
  4 +export interface SHA512Props extends HasherProps {
  5 + hash: Word64Array;
  6 +}
  7 +export declare class SHA512 extends Hasher {
  8 + protected _props?: Partial<SHA512Props>;
  9 + protected _blockSize: number;
  10 + protected _hash: Word64Array;
  11 + constructor(props?: Partial<SHA512Props>);
  12 + protected _doReset(): void;
  13 + protected _doProcessBlock(words: number[], offset: number): void;
  14 + protected _doFinalize(): Word32Array;
  15 + clone(): SHA512;
  16 + static hash(message: Word32Array | string, props?: SHA512Props): Word32Array;
  17 +}
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var e=t();for(var r in n.JsCrypto=n.JsCrypto||{},e)n.JsCrypto[r]=e[r]}}(this,(function(){return function(){"use strict";var n={3354:function(n,t,e){e.d(t,{e:function(){return o}});var r=e(5720),i=e(9054),o=function(){function n(t,e){if(Array.isArray(t)||!t)return this.t=Array.isArray(t)?t:[],void(this.i="number"==typeof e?e:4*this.t.length);if(t instanceof n)return this.t=t.words.slice(),void(this.i=t.nSigBytes);var r;try{t instanceof ArrayBuffer?r=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!r)throw new Error("Invalid argument");for(var i=r.byteLength,o=[],u=0;u<i;u++)o[u>>>2]|=r[u]<<24-u%4*8;this.t=o,this.i=i}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.i},set:function(n){this.i=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.t},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):r.p.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.t,t=this.i,e=new Uint8Array(t),r=0;r<t;r++)e[r]=n[r>>>2]>>>24-r%4*8&255;return e},n.prototype.concat=function(n){var t=n.words.slice(),e=n.nSigBytes;if(this.clamp(),this.i%4)for(var r=0;r<e;r++){var i=t[r>>>2]>>>24-r%4*8&255;this.t[this.i+r>>>2]|=i<<24-(this.i+r)%4*8}else for(r=0;r<e;r+=4)this.t[this.i+r>>>2]=t[r>>>2];return this.i+=e,this},n.prototype.clamp=function(){var n=this.i;this.t[n>>>2]&=4294967295<<32-n%4*8,this.t.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.t.slice(),this.i)},n.random=function(t){for(var e=[],r=0;r<t;r+=4)e.push((0,i.M)());return new n(e,t)},n}()},6957:function(n,t,e){e.d(t,{r:function(){return o},m:function(){return u}});var r=e(5720),i=e(3354),o=function(){function n(n,t){this.high=n,this.low=t}return n.prototype.clone=function(){return new n(this.high,this.low)},n}(),u=function(){function n(n,t){this.t=n||[],this.i="number"==typeof t?t:8*this.t.length}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.i},set:function(n){this.i=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.t},enumerable:!1,configurable:!0}),n.prototype.to32=function(){for(var n=[],t=0;t<this.t.length;t++){var e=this.t[t];n.push(e.high),n.push(e.low)}return new i.e(n,this.i)},n.prototype.toString=function(n){return n?n.stringify(this.to32()):r.p.stringify(this.to32())},n.prototype.clone=function(){for(var t=this.t.slice(),e=0;e<t.length;e++)t[e]=t[e].clone();return new n(t,this.i)},n}()},7211:function(n,t,e){e.d(t,{C:function(){return o}});var r=e(3354),i=e(4768),o=function(){function n(n){this.u=0,this.h=0,this.v=n,this.l=n&&void 0!==n.data?n.data.clone():new r.e,this.j=n&&"number"==typeof n.nBytes?n.nBytes:0}return Object.defineProperty(n.prototype,"blockSize",{get:function(){return this.h},enumerable:!1,configurable:!0}),n.prototype.reset=function(n,t){this.l=void 0!==n?n.clone():new r.e,this.j="number"==typeof t?t:0},n.prototype.A=function(n){var t="string"==typeof n?i.d.parse(n):n;this.l.concat(t),this.j+=t.nSigBytes},n.prototype.O=function(n){var t,e=this.l.words,i=this.l.nSigBytes,o=this.h,u=i/(4*this.h),f=(u=n?Math.ceil(u):Math.max((0|u)-this.u,0))*o,c=Math.min(4*f,i);if(f){for(var s=0;s<f;s+=o)this.I(e,s);t=e.splice(0,f),this.l.nSigBytes-=c}return new r.e(t,c)},n.prototype.I=function(n,t){throw new Error("Not implemented")},n}()},1868:function(n,t,e){e.d(t,{P:function(){return u}});var r,i=e(7211),o=(r=function(n,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])})(n,t)},function(n,t){function e(){this.constructor=n}r(n,t),n.prototype=null===t?Object.create(t):(e.prototype=t.prototype,new e)}),u=function(n){function t(t){var e=n.call(this,t)||this;return e.h=16,e.v=t,t&&"number"==typeof t.blockSize&&(e.h=t.blockSize),e.reset(t?t.data:void 0,t?t.nBytes:void 0),e}return o(t,n),Object.defineProperty(t.prototype,"blockSize",{get:function(){return this.h},enumerable:!1,configurable:!0}),t.prototype.reset=function(t,e){n.prototype.reset.call(this,t,e),this.U()},t.prototype.update=function(n){return this.A(n),this.O(),this},t.prototype.finalize=function(n){return n&&this.A(n),this.S()},t.prototype.U=function(){throw new Error("Not implemented")},t.prototype.S=function(){throw new Error("Not implemented")},t}(i.C)},1756:function(n,t,e){e.d(t,{w:function(){return u}});var r,i="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(r=parseInt((/msie (\d+)/.exec(i)||[])[1],10),isNaN(r)?(r=parseInt((/trident\/.*; rv:(\d+)/.exec(i)||[])[1],10),!isNaN(r)&&r):r);function u(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}},5720:function(n,t,e){e.d(t,{p:function(){return i}});var r=e(3354),i={stringify:function(n){for(var t=n.nSigBytes,e=n.words,r=[],i=0;i<t;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var e=[],i=0;i<t;i+=2)e[i>>>3]|=parseInt(n.substr(i,2),16)<<24-i%8*4;return new r.e(e,t/2)}}},8702:function(n,t,e){e.d(t,{m:function(){return i}});var r=e(3354),i={stringify:function(n){for(var t=n.nSigBytes,e=n.words,r=[],i=0;i<t;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(n){for(var t=n.length,e=[],i=0;i<t;i++)e[i>>>2]|=(255&n.charCodeAt(i))<<24-i%4*8;return new r.e(e,t)}}},4768:function(n,t,e){e.d(t,{d:function(){return i}});var r=e(8702),i={stringify:function(n){try{return decodeURIComponent(escape(r.m.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return r.m.parse(unescape(encodeURIComponent(n)))}}},9054:function(n,t,e){e.d(t,{M:function(){return i}});var r=e(1756);var i=function(){if("undefined"!=typeof window){var n=window.crypto||window.msCrypto;if(!n){if((0,r.w)("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return n.getRandomValues(new Uint32Array(1))[0]}}return void 0!==e.g&&e.g.crypto?function(){return e.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}()}},t={};function e(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return n[r](o,o.exports,e),o.exports}e.d=function(n,t){for(var r in t)e.o(t,r)&&!e.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:t[r]})},e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),e.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},e.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"_",{value:!0})};var r={};return function(){e.r(r),e.d(r,{SHA512:function(){return c}});var n,t=e(1868),i=e(6957),o=(n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])})(t,e)},function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),u=[new i.r(1116352408,3609767458),new i.r(1899447441,602891725),new i.r(3049323471,3964484399),new i.r(3921009573,2173295548),new i.r(961987163,4081628472),new i.r(1508970993,3053834265),new i.r(2453635748,2937671579),new i.r(2870763221,3664609560),new i.r(3624381080,2734883394),new i.r(310598401,1164996542),new i.r(607225278,1323610764),new i.r(1426881987,3590304994),new i.r(1925078388,4068182383),new i.r(2162078206,991336113),new i.r(2614888103,633803317),new i.r(3248222580,3479774868),new i.r(3835390401,2666613458),new i.r(4022224774,944711139),new i.r(264347078,2341262773),new i.r(604807628,2007800933),new i.r(770255983,1495990901),new i.r(1249150122,1856431235),new i.r(1555081692,3175218132),new i.r(1996064986,2198950837),new i.r(2554220882,3999719339),new i.r(2821834349,766784016),new i.r(2952996808,2566594879),new i.r(3210313671,3203337956),new i.r(3336571891,1034457026),new i.r(3584528711,2466948901),new i.r(113926993,3758326383),new i.r(338241895,168717936),new i.r(666307205,1188179964),new i.r(773529912,1546045734),new i.r(1294757372,1522805485),new i.r(1396182291,2643833823),new i.r(1695183700,2343527390),new i.r(1986661051,1014477480),new i.r(2177026350,1206759142),new i.r(2456956037,344077627),new i.r(2730485921,1290863460),new i.r(2820302411,3158454273),new i.r(3259730800,3505952657),new i.r(3345764771,106217008),new i.r(3516065817,3606008344),new i.r(3600352804,1432725776),new i.r(4094571909,1467031594),new i.r(275423344,851169720),new i.r(430227734,3100823752),new i.r(506948616,1363258195),new i.r(659060556,3750685593),new i.r(883997877,3785050280),new i.r(958139571,3318307427),new i.r(1322822218,3812723403),new i.r(1537002063,2003034995),new i.r(1747873779,3602036899),new i.r(1955562222,1575990012),new i.r(2024104815,1125592928),new i.r(2227730452,2716904306),new i.r(2361852424,442776044),new i.r(2428436474,593698344),new i.r(2756734187,3733110249),new i.r(3204031479,2999351573),new i.r(3329325298,3815920427),new i.r(3391569614,3928383900),new i.r(3515267271,566280711),new i.r(3940187606,3454069534),new i.r(4118630271,4000239992),new i.r(116418474,1914138554),new i.r(174292421,2731055270),new i.r(289380356,3203993006),new i.r(460393269,320620315),new i.r(685471733,587496836),new i.r(852142971,1086792851),new i.r(1017036298,365543100),new i.r(1126000580,2618297676),new i.r(1288033470,3409855158),new i.r(1501505948,4234509866),new i.r(1607167915,987167468),new i.r(1816402316,1246189591)],f=[];!function(){for(var n=0;n<80;n++)f[n]=new i.r(0,0)}();var c=function(n){function t(t){var e=n.call(this,t)||this;return e.h=32,e.N=new i.m([new i.r(1779033703,4089235720),new i.r(3144134277,2227873595),new i.r(1013904242,4271175723),new i.r(2773480762,1595750129),new i.r(1359893119,2917565137),new i.r(2600822924,725511199),new i.r(528734635,4215389547),new i.r(1541459225,327033209)]),e.v=t,t&&void 0!==t.hash&&(e.N=t.hash.clone()),e}return o(t,n),t.prototype.U=function(){this.N=new i.m([new i.r(1779033703,4089235720),new i.r(3144134277,2227873595),new i.r(1013904242,4271175723),new i.r(2773480762,1595750129),new i.r(1359893119,2917565137),new i.r(2600822924,725511199),new i.r(528734635,4215389547),new i.r(1541459225,327033209)])},t.prototype.I=function(n,t){for(var e=this.N.words,r=e[0],i=e[1],o=e[2],c=e[3],s=e[4],w=e[5],a=e[6],h=e[7],v=r.high,d=r.low,l=i.high,b=i.low,y=o.high,p=o.low,m=c.high,g=c.low,j=s.high,A=s.low,O=w.high,I=w.low,E=a.high,M=a.low,U=h.high,S=h.low,_=v,N=d,x=l,C=b,F=y,B=p,k=m,z=g,H=j,T=A,P=O,R=I,q=E,$=M,D=U,G=S,J=0;J<80;J++){var K=void 0,L=void 0,Q=f[J];if(J<16)L=Q.high=0|n[t+2*J],K=Q.low=0|n[t+2*J+1];else{var V=f[J-15],W=V.high,X=V.low,Y=(W>>>1|X<<31)^(W>>>8|X<<24)^W>>>7,Z=(X>>>1|W<<31)^(X>>>8|W<<24)^(X>>>7|W<<25),nn=f[J-2],tn=nn.high,en=nn.low,rn=(tn>>>19|en<<13)^(tn<<3|en>>>29)^tn>>>6,on=(en>>>19|tn<<13)^(en<<3|tn>>>29)^(en>>>6|tn<<26),un=f[J-7],fn=un.high,cn=un.low,sn=f[J-16],wn=sn.high,an=sn.low;L=(L=(L=Y+fn+((K=Z+cn)>>>0<Z>>>0?1:0))+rn+((K+=on)>>>0<on>>>0?1:0))+wn+((K+=an)>>>0<an>>>0?1:0),Q.high=L,Q.low=K}var hn=H&P^~H&q,vn=T&R^~T&$,dn=_&x^_&F^x&F,ln=N&C^N&B^C&B,bn=(_>>>28|N<<4)^(_<<30|N>>>2)^(_<<25|N>>>7),yn=(N>>>28|_<<4)^(N<<30|_>>>2)^(N<<25|_>>>7),pn=(H>>>14|T<<18)^(H>>>18|T<<14)^(H<<23|T>>>9),mn=(T>>>14|H<<18)^(T>>>18|H<<14)^(T<<23|H>>>9),gn=u[J],jn=gn.high,An=gn.low,On=G+mn,In=D+pn+(On>>>0<G>>>0?1:0),En=yn+ln;D=q,G=$,q=P,$=R,P=H,R=T,H=k+(In=(In=(In=In+hn+((On+=vn)>>>0<vn>>>0?1:0))+jn+((On+=An)>>>0<An>>>0?1:0))+L+((On+=K)>>>0<K>>>0?1:0))+((T=z+On|0)>>>0<z>>>0?1:0)|0,k=F,z=B,F=x,B=C,x=_,C=N,_=In+(bn+dn+(En>>>0<yn>>>0?1:0))+((N=On+En|0)>>>0<On>>>0?1:0)|0}d=r.low=d+N,r.high=v+_+(d>>>0<N>>>0?1:0),b=i.low=b+C,i.high=l+x+(b>>>0<C>>>0?1:0),p=o.low=p+B,o.high=y+F+(p>>>0<B>>>0?1:0),g=c.low=g+z,c.high=m+k+(g>>>0<z>>>0?1:0),A=s.low=A+T,s.high=j+H+(A>>>0<T>>>0?1:0),I=w.low=I+R,w.high=O+P+(I>>>0<R>>>0?1:0),M=a.low=M+$,a.high=E+q+(M>>>0<$>>>0?1:0),S=h.low=S+G,h.high=U+D+(S>>>0<G>>>0?1:0)},t.prototype.S=function(){var n=this.l,t=n.words,e=8*this.j,r=8*n.nSigBytes;return t[r>>>5]|=128<<24-r%32,t[30+(r+128>>>10<<5)]=Math.floor(e/4294967296),t[31+(r+128>>>10<<5)]=e,n.nSigBytes=4*t.length,this.O(),this.N.to32()},t.prototype.clone=function(){return new t({hash:this.N,blockSize:this.h,data:this.l,nBytes:this.j})},t.hash=function(n,e){return new t(e).finalize(n)},t}(t.P)}(),r}()}));
\ No newline at end of file
... ...
  1 +export { Utf16LE, Utf16BE, Utf16 } from "./lib/encoder/Utf16";
... ...
  1 +!function(n,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r();else if("function"==typeof define&&define.amd)define([],r);else if("object"==typeof exports)exports.JsCrypto=r();else{var t=r();for(var e in n.JsCrypto=n.JsCrypto||{},t)n.JsCrypto[e]=t[e]}}(this,(function(){return function(){"use strict";var n={d:function(r,t){for(var e in t)n.o(t,e)&&!n.o(r,e)&&Object.defineProperty(r,e,{enumerable:!0,get:t[e]})}};n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),n.o=function(n,r){return Object.prototype.hasOwnProperty.call(n,r)},n.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"t",{value:!0})};var r={};n.r(r),n.d(r,{Utf16:function(){return h},Utf16BE:function(){return a},Utf16LE:function(){return c}});var t,e=function(n){for(var r=n.nSigBytes,t=n.words,e=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;e.push((o>>>4).toString(16)),e.push((15&o).toString(16))}return e.join("")},i="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(t=parseInt((/msie (\d+)/.exec(i)||[])[1],10),isNaN(t)?(t=parseInt((/trident\/.*; rv:(\d+)/.exec(i)||[])[1],10),!isNaN(t)&&t):t);var f=function(){if("undefined"!=typeof window){var r=window.crypto||window.msCrypto;if(!r){if(function(n,r){return!1!==o&&(!r||("<"===n?o<r:"<="===n?o<=r:">"===n?o>r:">="===n?o>=r:o===r))}("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return r.getRandomValues(new Uint32Array(1))[0]}}return void 0!==n.g&&n.g.crypto?function(){return n.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}(),u=function(){function n(r,t){if(Array.isArray(r)||!r)return this.i=Array.isArray(r)?r:[],void(this.u="number"==typeof t?t:4*this.i.length);if(r instanceof n)return this.i=r.words.slice(),void(this.u=r.nSigBytes);var e;try{r instanceof ArrayBuffer?e=new Uint8Array(r):(r instanceof Uint8Array||r instanceof Int8Array||r instanceof Uint8ClampedArray||r instanceof Int16Array||r instanceof Uint16Array||r instanceof Int32Array||r instanceof Uint32Array||r instanceof Float32Array||r instanceof Float64Array)&&(e=new Uint8Array(r.buffer,r.byteOffset,r.byteLength))}catch(n){throw new Error("Invalid argument")}if(!e)throw new Error("Invalid argument");for(var i=e.byteLength,o=[],f=0;f<i;f++)o[f>>>2]|=e[f]<<24-f%4*8;this.i=o,this.u=i}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.u},set:function(n){this.u=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.i},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):e(this)},n.prototype.toUint8Array=function(){for(var n=this.i,r=this.u,t=new Uint8Array(r),e=0;e<r;e++)t[e]=n[e>>>2]>>>24-e%4*8&255;return t},n.prototype.concat=function(n){var r=n.words.slice(),t=n.nSigBytes;if(this.clamp(),this.u%4)for(var e=0;e<t;e++){var i=r[e>>>2]>>>24-e%4*8&255;this.i[this.u+e>>>2]|=i<<24-(this.u+e)%4*8}else for(e=0;e<t;e+=4)this.i[this.u+e>>>2]=r[e>>>2];return this.u+=t,this},n.prototype.clamp=function(){var n=this.u;this.i[n>>>2]&=4294967295<<32-n%4*8,this.i.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.i.slice(),this.u)},n.random=function(r){for(var t=[],e=0;e<r;e+=4)t.push(f());return new n(t,r)},n}(),a={stringify:function(n){for(var r=n.words,t=n.nSigBytes,e=[],i=0;i<t;i+=2){var o=r[i>>>2]>>>16-i%4*8&65535;e.push(String.fromCharCode(o))}return e.join("")},parse:function(n){for(var r=n.length,t=[],e=0;e<r;e++)t[e>>>1]|=n.charCodeAt(e)<<16-e%2*16;return new u(t,2*r)}};function s(n){return n<<8&4278255360|n>>>8&16711935}var c={stringify:function(n){for(var r=n.words,t=n.nSigBytes,e=[],i=0;i<t;i+=2){var o=s(r[i>>>2]>>>16-i%4*8&65535);e.push(String.fromCharCode(o))}return e.join("")},parse:function(n){for(var r=n.length,t=[],e=0;e<r;e++)t[e>>>1]|=s(n.charCodeAt(e)<<16-e%2*16);return new u(t,2*r)}},h=a;return r}()}));
\ No newline at end of file
... ...
  1 +export { Utf8 } from "./lib/encoder/Utf8";
... ...
  1 +!function(n,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r();else if("function"==typeof define&&define.amd)define([],r);else if("object"==typeof exports)exports.JsCrypto=r();else{var t=r();for(var e in n.JsCrypto=n.JsCrypto||{},t)n.JsCrypto[e]=t[e]}}(this,(function(){return function(){"use strict";var n={d:function(r,t){for(var e in t)n.o(t,e)&&!n.o(r,e)&&Object.defineProperty(r,e,{enumerable:!0,get:t[e]})}};n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),n.o=function(n,r){return Object.prototype.hasOwnProperty.call(n,r)},n.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"t",{value:!0})};var r={};n.r(r),n.d(r,{Utf8:function(){return c}});var t,e=function(n){for(var r=n.nSigBytes,t=n.words,e=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;e.push((o>>>4).toString(16)),e.push((15&o).toString(16))}return e.join("")},i="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(t=parseInt((/msie (\d+)/.exec(i)||[])[1],10),isNaN(t)?(t=parseInt((/trident\/.*; rv:(\d+)/.exec(i)||[])[1],10),!isNaN(t)&&t):t);var a=function(){if("undefined"!=typeof window){var r=window.crypto||window.msCrypto;if(!r){if(function(n,r){return!1!==o&&(!r||("<"===n?o<r:"<="===n?o<=r:">"===n?o>r:">="===n?o>=r:o===r))}("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return r.getRandomValues(new Uint32Array(1))[0]}}return void 0!==n.g&&n.g.crypto?function(){return n.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}(),u=function(){function n(r,t){if(Array.isArray(r)||!r)return this.i=Array.isArray(r)?r:[],void(this.u="number"==typeof t?t:4*this.i.length);if(r instanceof n)return this.i=r.words.slice(),void(this.u=r.nSigBytes);var e;try{r instanceof ArrayBuffer?e=new Uint8Array(r):(r instanceof Uint8Array||r instanceof Int8Array||r instanceof Uint8ClampedArray||r instanceof Int16Array||r instanceof Uint16Array||r instanceof Int32Array||r instanceof Uint32Array||r instanceof Float32Array||r instanceof Float64Array)&&(e=new Uint8Array(r.buffer,r.byteOffset,r.byteLength))}catch(n){throw new Error("Invalid argument")}if(!e)throw new Error("Invalid argument");for(var i=e.byteLength,o=[],a=0;a<i;a++)o[a>>>2]|=e[a]<<24-a%4*8;this.i=o,this.u=i}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.u},set:function(n){this.u=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.i},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):e(this)},n.prototype.toUint8Array=function(){for(var n=this.i,r=this.u,t=new Uint8Array(r),e=0;e<r;e++)t[e]=n[e>>>2]>>>24-e%4*8&255;return t},n.prototype.concat=function(n){var r=n.words.slice(),t=n.nSigBytes;if(this.clamp(),this.u%4)for(var e=0;e<t;e++){var i=r[e>>>2]>>>24-e%4*8&255;this.i[this.u+e>>>2]|=i<<24-(this.u+e)%4*8}else for(e=0;e<t;e+=4)this.i[this.u+e>>>2]=r[e>>>2];return this.u+=t,this},n.prototype.clamp=function(){var n=this.u;this.i[n>>>2]&=4294967295<<32-n%4*8,this.i.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.i.slice(),this.u)},n.random=function(r){for(var t=[],e=0;e<r;e+=4)t.push(a());return new n(t,r)},n}(),f=function(n){for(var r=n.nSigBytes,t=n.words,e=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;e.push(String.fromCharCode(o))}return e.join("")},s=function(n){for(var r=n.length,t=[],e=0;e<r;e++)t[e>>>2]|=(255&n.charCodeAt(e))<<24-e%4*8;return new u(t,r)},c={stringify:function(n){try{return decodeURIComponent(escape(f(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return s(unescape(encodeURIComponent(n)))}};return r}()}));
\ No newline at end of file
... ...
  1 +export { Word32Array } from "./lib/Word32Array";
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var e in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[e]=r[e]}}(this,(function(){return function(){"use strict";var n={d:function(t,r){for(var e in r)n.o(r,e)&&!n.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:r[e]})}};n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),n.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},n.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"t",{value:!0})};var t={};n.r(t),n.d(t,{Word32Array:function(){return u}});var r,e=function(n){for(var t=n.nSigBytes,r=n.words,e=[],i=0;i<t;i++){var o=r[i>>>2]>>>24-i%4*8&255;e.push((o>>>4).toString(16)),e.push((15&o).toString(16))}return e.join("")},i="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",o=(r=parseInt((/msie (\d+)/.exec(i)||[])[1],10),isNaN(r)?(r=parseInt((/trident\/.*; rv:(\d+)/.exec(i)||[])[1],10),!isNaN(r)&&r):r);var a=function(){if("undefined"!=typeof window){var t=window.crypto||window.msCrypto;if(!t){if(function(n,t){return!1!==o&&(!t||("<"===n?o<t:"<="===n?o<=t:">"===n?o>t:">="===n?o>=t:o===t))}("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return t.getRandomValues(new Uint32Array(1))[0]}}return void 0!==n.g&&n.g.crypto?function(){return n.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}(),u=function(){function n(t,r){if(Array.isArray(t)||!t)return this.i=Array.isArray(t)?t:[],void(this.u="number"==typeof r?r:4*this.i.length);if(t instanceof n)return this.i=t.words.slice(),void(this.u=t.nSigBytes);var e;try{t instanceof ArrayBuffer?e=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!e)throw new Error("Invalid argument");for(var i=e.byteLength,o=[],a=0;a<i;a++)o[a>>>2]|=e[a]<<24-a%4*8;this.i=o,this.u=i}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.u},set:function(n){this.u=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.i},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):e(this)},n.prototype.toUint8Array=function(){for(var n=this.i,t=this.u,r=new Uint8Array(t),e=0;e<t;e++)r[e]=n[e>>>2]>>>24-e%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.u%4)for(var e=0;e<r;e++){var i=t[e>>>2]>>>24-e%4*8&255;this.i[this.u+e>>>2]|=i<<24-(this.u+e)%4*8}else for(e=0;e<r;e+=4)this.i[this.u+e>>>2]=t[e>>>2];return this.u+=r,this},n.prototype.clamp=function(){var n=this.u;this.i[n>>>2]&=4294967295<<32-n%4*8,this.i.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.i.slice(),this.u)},n.random=function(t){for(var r=[],e=0;e<t;e+=4)r.push(a());return new n(r,t)},n}();return t}()}));
\ No newline at end of file
... ...
  1 +export { Word64, Word64Array } from "./lib/Word64Array";
... ...
  1 +!function(n,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else if("object"==typeof exports)exports.JsCrypto=t();else{var r=t();for(var e in n.JsCrypto=n.JsCrypto||{},r)n.JsCrypto[e]=r[e]}}(this,(function(){return function(){"use strict";var n={d:function(t,r){for(var e in r)n.o(r,e)&&!n.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:r[e]})}};n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),n.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},n.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"t",{value:!0})};var t={};n.r(t),n.d(t,{Word64:function(){return s},Word64Array:function(){return a}});var r,e="undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.toLowerCase():"",i=(r=parseInt((/msie (\d+)/.exec(e)||[])[1],10),isNaN(r)?(r=parseInt((/trident\/.*; rv:(\d+)/.exec(e)||[])[1],10),!isNaN(r)&&r):r);var o=function(){if("undefined"!=typeof window){var t=window.crypto||window.msCrypto;if(!t){if(function(n,t){return!1!==i&&(!t||("<"===n?i<t:"<="===n?i<=t:">"===n?i>t:">="===n?i>=t:i===t))}("<",11))return console.warn("IE <= 10 uses insecure random generator. Please consider to use IE11 or another modern browser"),function(){return Math.floor(512*Math.random())%256};throw new Error("Crypto module not found")}return function(){return t.getRandomValues(new Uint32Array(1))[0]}}return void 0!==n.g&&n.g.crypto?function(){return n.g.crypto.randomBytes(4).readInt32LE()}:function(){return require("crypto").randomBytes(4).readInt32LE()}}(),u=function(){function n(t,r){if(Array.isArray(t)||!t)return this.i=Array.isArray(t)?t:[],void(this.u="number"==typeof r?r:4*this.i.length);if(t instanceof n)return this.i=t.words.slice(),void(this.u=t.nSigBytes);var e;try{t instanceof ArrayBuffer?e=new Uint8Array(t):(t instanceof Uint8Array||t instanceof Int8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}catch(n){throw new Error("Invalid argument")}if(!e)throw new Error("Invalid argument");for(var i=e.byteLength,o=[],u=0;u<i;u++)o[u>>>2]|=e[u]<<24-u%4*8;this.i=o,this.u=i}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.u},set:function(n){this.u=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.i},enumerable:!1,configurable:!0}),n.prototype.toString=function(n){return n?n.stringify(this):f.stringify(this)},n.prototype.toUint8Array=function(){for(var n=this.i,t=this.u,r=new Uint8Array(t),e=0;e<t;e++)r[e]=n[e>>>2]>>>24-e%4*8&255;return r},n.prototype.concat=function(n){var t=n.words.slice(),r=n.nSigBytes;if(this.clamp(),this.u%4)for(var e=0;e<r;e++){var i=t[e>>>2]>>>24-e%4*8&255;this.i[this.u+e>>>2]|=i<<24-(this.u+e)%4*8}else for(e=0;e<r;e+=4)this.i[this.u+e>>>2]=t[e>>>2];return this.u+=r,this},n.prototype.clamp=function(){var n=this.u;this.i[n>>>2]&=4294967295<<32-n%4*8,this.i.length=Math.ceil(n/4)},n.prototype.clone=function(){return new n(this.i.slice(),this.u)},n.random=function(t){for(var r=[],e=0;e<t;e+=4)r.push(o());return new n(r,t)},n}(),f={stringify:function(n){for(var t=n.nSigBytes,r=n.words,e=[],i=0;i<t;i++){var o=r[i>>>2]>>>24-i%4*8&255;e.push((o>>>4).toString(16)),e.push((15&o).toString(16))}return e.join("")},parse:function(n){var t=n.length;if(t%2!=0)throw new Error("Hex string count must be even");if(!/^[a-fA-F0-9]+$/.test(n))throw new Error("Invalid Hex string: "+n);for(var r=[],e=0;e<t;e+=2)r[e>>>3]|=parseInt(n.substr(e,2),16)<<24-e%8*4;return new u(r,t/2)}},s=function(){function n(n,t){this.high=n,this.low=t}return n.prototype.clone=function(){return new n(this.high,this.low)},n}(),a=function(){function n(n,t){this.i=n||[],this.u="number"==typeof t?t:8*this.i.length}return Object.defineProperty(n.prototype,"nSigBytes",{get:function(){return this.u},set:function(n){this.u=n},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"words",{get:function(){return this.i},enumerable:!1,configurable:!0}),n.prototype.to32=function(){for(var n=[],t=0;t<this.i.length;t++){var r=this.i[t];n.push(r.high),n.push(r.low)}return new u(n,this.u)},n.prototype.toString=function(n){return n?n.stringify(this.to32()):f.stringify(this.to32())},n.prototype.clone=function(){for(var t=this.i.slice(),r=0;r<t.length;r++)t[r]=t[r].clone();return new n(t,this.u)},n}();return t}()}));
\ No newline at end of file
... ...
  1 +#!/usr/bin/env node
  2 +
  3 +const hashCommands = [
  4 + "md5", "sha1", "sha3", "sha224", "sha256", "sha384", "sha512", "ripemd160"
  5 +];
  6 +
  7 +const hmacCommands = [
  8 + "hmac-md5", "hmac-sha1", "hmac-sha224", "hmac-sha256", "hmac-sha384", "hmac-sha512"
  9 +];
  10 +
  11 +const cipherCommands = [
  12 + "aes", "des", "des3", "rc4"
  13 +];
  14 +
  15 +const exeCommand = "npx jscrypto"// process.argv.slice(0, 2).join(" ");
  16 +
  17 +const manJsCrypto = [
  18 + `Usage: ${exeCommand} <hash|hmac|cipher> [command options]\n`,
  19 + "\n",
  20 + " hash: " + hashCommands.join(", ") + "\n",
  21 + " hmac: " + hmacCommands.join(", ") + "\n",
  22 + " cipher: " + cipherCommands.join(", ") + "\n",
  23 +].join("");
  24 +
  25 +const manJsCryptoHash = [
  26 + `${exeCommand} <hash> message [-msg hex|base64|utf8] [-out hex|base64]\n`,
  27 + "\n",
  28 + ` <hash>: ${hashCommands.join(", ")}\n`,
  29 + " default:\n",
  30 + " -msg: utf8 ... recognize message as utf-8 string\n",
  31 + " -out: hex ... output hashed binary as hex string\n",
  32 + " example: \n",
  33 + " #Output of below 3 examples are the same\n",
  34 + " npx jscrypto sha1 test\n",
  35 + " npx jscrypto sha1 74657374 -in hex\n",
  36 + " npx jscrypto sha1 dGVzdA== -in base64\n",
  37 +].join("");
  38 +
  39 +const manJsCryptoHmac = [
  40 + `${exeCommand} <hmac> message key [-msg hex|base64|utf8] [-key hex|base64|utf8] [-out hex|base64]\n`,
  41 + "\n",
  42 + ` <hmac>: ${hmacCommands.join(", ")}\n`,
  43 + " default:\n",
  44 + " -msg: utf8 ... recognize message as utf-8 string\n",
  45 + " -key: utf8 ... recognize key as utf-8 string\n",
  46 + " -out: hex ... output hashed binary as hex string\n",
  47 + " example: \n",
  48 + " #Output of below 3 examples are the same\n",
  49 + " npx jscrypto hmac-sha1 test key\n",
  50 + " npx jscrypto hmac-sha1 74657374 6b6579 -msg hex -key hex\n",
  51 + " npx jscrypto hmac-sha1 dGVzdA== a2V5 -msg base64 -key base64\n",
  52 +].join("");
  53 +
  54 +const manJsCryptoCipher = [
  55 + `${exeCommand} <cipher> <enc|dec> <message> key [-msg hex|base64|utf8] [-key hex|base64|utf8] [-out hex|base64|utf8] [-mode cbc|ecb|ofb|cfb|ctr] [-pad pkcs7|iso10126|iso97971|ansix923|nopadding] [-kdf pbkdf2|evpkdf] [-kdfIter n] [-kdfHasher hash]\n`,
  56 + "\n",
  57 + ` <cipher>: ${cipherCommands.join(", ")}\n`,
  58 + " <message>: If encrypting, utf8/hex/base64 value. If decrypting, base64 encoded encrypted string\n",
  59 + " default:\n",
  60 + " -msg: utf8 ... recognize message as utf-8 string\n",
  61 + " -key: utf8 ... recognize key as utf-8 string\n",
  62 + " -out: hex ... for decryption only. output hashed binary as hex string\n",
  63 + " -mode: cbc ... Cipher block chaining as block cipher mode\n",
  64 + " -pad: pkcs7 ... Pkcs7 padding as block padding\n",
  65 + " -kdf: pbkdf2 ... PBKDF2 as key derivation function\n",
  66 + " -kdfIter: 10000 ... kdf iteration count\n",
  67 + " -kdfHasher: sha256 ... kdf hasher\n",
  68 + " example: \n",
  69 + " #Encrypt (Output would not be the same because of a random salt, but can be decrypted with the same key)\n",
  70 + " npx jscrypto aes enc test password\n",
  71 + " npx jscrypto aes enc 74657374 70617373776f7264 -msg hex -key hex\n",
  72 + " npx jscrypto aes enc dGVzdA== cGFzc3dvcmQ= -msg base64 -key base64\n",
  73 + " #Decrypt\n",
  74 + " npx jscrypto aes dec U2FsdGVkX19Kf/wItWMuaTrQYV3OljA3Cr9WPMhC6Tk= password -out utf8\n",
  75 + " npx jscrypto aes dec A2pYDd/3oeENsRFGA1Y0Mg== 70617373776f7264 -key hex -out utf8\n",
  76 + " npx jscrypto aes dec A2pYDd/3oeENsRFGA1Y0Mg== cGFzc3dvcmQ= -key base64 -out utf8\n",
  77 +].join("");
  78 +
  79 +const man = [
  80 + manJsCrypto,
  81 + manJsCryptoHash,
  82 + manJsCryptoHmac,
  83 + manJsCryptoCipher,
  84 +].join("\n\n");
  85 +
  86 +// const resolve = (file) => `../dist/${file}`; // Use if you git clone this project and want to debug cli.js
  87 +const path = require("path");
  88 +const resolve = (file) => path.join("..", file);
  89 +
  90 +const args = process.argv.slice(2);
  91 +
  92 +if(args.length < 1){
  93 + console.error("ERROR: command is not specified");
  94 + console.error("");
  95 + console.log(man);
  96 + process.exit(1);
  97 +}
  98 +
  99 +const command = args[0];
  100 +if(hashCommands.includes(command)){
  101 + doHash();
  102 +}
  103 +else if(hmacCommands.includes(command)){
  104 + doHmac();
  105 +}
  106 +else if(cipherCommands.includes(command)){
  107 + doCipher();
  108 +}
  109 +else{
  110 + console.error("ERROR: Unknown command");
  111 + console.error("");
  112 + console.log(man);
  113 + process.exit(1);
  114 +}
  115 +
  116 +function doHash(){
  117 + const messageArg = args[1];
  118 + const optionArgs = args.slice(2);
  119 + const options = {
  120 + msg: "utf8",
  121 + out: "hex",
  122 + };
  123 +
  124 + if(optionArgs){
  125 + for(let i=0;i<optionArgs.length;i++){
  126 + const o1 = optionArgs[i];
  127 + const o2 = optionArgs[i+1];
  128 + if(o1 === "-msg"){
  129 + if(!["hex", "base64", "utf8"].includes(o2)){
  130 + console.error("ERROR: Unknown -in value");
  131 + console.error("");
  132 + console.log(manJsCryptoHash);
  133 + process.exit(1);
  134 + }
  135 + options.msg = o2;
  136 + i += 1;
  137 + }
  138 + else if(o1 === "-out"){
  139 + if(!["hex", "base64", "utf8"].includes(o2)){
  140 + console.error("ERROR: Unknown -out value");
  141 + console.error("");
  142 + console.log(manJsCryptoHash);
  143 + process.exit(1);
  144 + }
  145 + options.out = o2;
  146 + i += 1;
  147 + }
  148 + else{
  149 + console.error("ERROR: Unknown option");
  150 + console.error("");
  151 + console.log(manJsCryptoHash);
  152 + process.exit(1);
  153 + }
  154 + }
  155 + }
  156 +
  157 + let Hasher;
  158 + switch (command.toLowerCase()){
  159 + case "md5": Hasher = require(resolve("MD5")).MD5; break;
  160 + case "sha1": Hasher = require(resolve("SHA1")).SHA1; break;
  161 + case "sha3": Hasher = require(resolve("SHA3")).SHA3; break;
  162 + case "sha224": Hasher = require(resolve("SHA224")).SHA224; break;
  163 + case "sha256": Hasher = require(resolve("SHA256")).SHA256; break;
  164 + case "sha384": Hasher = require(resolve("SHA384")).SHA384; break;
  165 + case "sha512": Hasher = require(resolve("SHA512")).SHA512; break;
  166 + case "ripemd160": Hasher = require(resolve("RIPEMD160")).RIPEMD160; break;
  167 + default:
  168 + console.error("ERROR: Unknown hash");
  169 + console.error("");
  170 + console.log(manJsCryptoHash);
  171 + process.exit(1);
  172 + }
  173 +
  174 + let message;
  175 + if(options.msg.toLowerCase() === "utf8"){
  176 + message = messageArg;
  177 + }
  178 + else if(options.msg.toLowerCase() === "hex"){
  179 + if(!/^[0-9a-fA-F]+$/.test(messageArg)){
  180 + console.error("ERROR: Invalid Hex input");
  181 + process.exit(1);
  182 + }
  183 + else if(messageArg.length % 2 !== 0){
  184 + console.error("ERROR: Hex character count must be even");
  185 + process.exit(1);
  186 + }
  187 +
  188 + const {Hex} = require(resolve("Hex"));
  189 + message = Hex.parse(messageArg);
  190 + }
  191 + else if(options.msg.toLowerCase() === "base64"){
  192 + const {Base64} = require(resolve("Base64"));
  193 + message = Base64.parse(messageArg);
  194 + }
  195 + else{
  196 + console.error("ERROR: unknown -msg value");
  197 + process.exit(1);
  198 + }
  199 +
  200 + let outputEncoding;
  201 + if(options.out.toLowerCase() === "hex"){
  202 + outputEncoding = require(resolve("Hex")).Hex;
  203 + }
  204 + else if(options.out.toLowerCase() === "base64"){
  205 + outputEncoding = require(resolve("Base64")).Base64;
  206 + }
  207 + else{
  208 + console.error("ERROR: unknown -out value");
  209 + process.exit(1);
  210 + }
  211 +
  212 + const result = Hasher.hash(message);
  213 + let output;
  214 + try{
  215 + output = result.toString(outputEncoding);
  216 + }
  217 + catch(e){
  218 + if(options.out === "utf8"){
  219 + console.error("ERROR: Byte array could not be recognized as UTF-8");
  220 + }
  221 + else{
  222 + console.error("ERROR: Failed to hash message");
  223 + }
  224 + process.exit(1);
  225 + }
  226 +
  227 + console.log(output);
  228 + process.exit(0);
  229 +}
  230 +
  231 +function doHmac(){
  232 + const messageArg = args[1] || "";
  233 + const keyArg = args[2] || "";
  234 + const optionArgs = args.slice(3);
  235 + const options = {
  236 + msg: "utf8",
  237 + key: "utf8",
  238 + out: "hex",
  239 + };
  240 +
  241 + if(optionArgs){
  242 + for(let i=0;i<optionArgs.length;i++){
  243 + const o1 = optionArgs[i];
  244 + const o2 = optionArgs[i+1];
  245 + if(o1 === "-msg"){
  246 + if(!["hex", "base64", "utf8"].includes(o2)){
  247 + console.error("ERROR: Unknown -msg value");
  248 + console.error("");
  249 + console.log(manJsCryptoHmac);
  250 + process.exit(1);
  251 + }
  252 + options.msg = o2;
  253 + i += 1;
  254 + }
  255 + else if(o1 === "-key"){
  256 + if(!["hex", "base64", "utf8"].includes(o2)){
  257 + console.error("ERROR: Unknown -key value");
  258 + console.error("");
  259 + console.log(manJsCryptoHmac);
  260 + process.exit(1);
  261 + }
  262 + options.key = o2;
  263 + i += 1;
  264 + }
  265 + else if(o1 === "-out"){
  266 + if(!["hex", "base64", "utf8"].includes(o2)){
  267 + console.error("ERROR: Unknown -out value");
  268 + console.error("");
  269 + console.log(manJsCryptoHmac);
  270 + process.exit(1);
  271 + }
  272 + options.out = o2;
  273 + i += 1;
  274 + }
  275 + else{
  276 + console.error("ERROR: Unknown option");
  277 + console.error("");
  278 + console.log(manJsCryptoHmac);
  279 + process.exit(1);
  280 + }
  281 + }
  282 + }
  283 +
  284 + let Hasher;
  285 + switch (command.replace(/-/g, "").toLowerCase()){
  286 + case "hmacmd5": Hasher = require(resolve("HmacMD5")).HmacMD5; break;
  287 + case "hmacsha1": Hasher = require(resolve("HmacSHA1")).HmacSHA1; break;
  288 + case "hmacsha224": Hasher = require(resolve("HmacSHA224")).HmacSHA224; break;
  289 + case "hmacsha256": Hasher = require(resolve("HmacSHA256")).HmacSHA256; break;
  290 + case "hmacsha384": Hasher = require(resolve("HmacSHA384")).HmacSHA384; break;
  291 + case "hmacsha512": Hasher = require(resolve("HmacSHA512")).HmacSHA512; break;
  292 + default:
  293 + console.error("ERROR: Unknown hmac hasher");
  294 + console.error("");
  295 + console.log(manJsCryptoHmac);
  296 + process.exit(1);
  297 + }
  298 +
  299 + let message;
  300 + if(options.msg.toLowerCase() === "utf8"){
  301 + message = messageArg;
  302 + }
  303 + else if(options.msg.toLowerCase() === "hex"){
  304 + if(!/^[0-9a-fA-F]+$/.test(messageArg)){
  305 + console.error("ERROR: Invalid Hex input");
  306 + process.exit(1);
  307 + }
  308 + else if(messageArg.length % 2 !== 0){
  309 + console.error("ERROR: Hex character count must be even");
  310 + process.exit(1);
  311 + }
  312 +
  313 + const {Hex} = require(resolve("Hex"));
  314 + message = Hex.parse(messageArg);
  315 + }
  316 + else if(options.msg.toLowerCase() === "base64"){
  317 + const {Base64} = require(resolve("Base64"));
  318 + message = Base64.parse(messageArg);
  319 + }
  320 + else{
  321 + console.error("ERROR: unknown -msg value");
  322 + process.exit(1);
  323 + }
  324 +
  325 + let key;
  326 + if(options.key.toLowerCase() === "utf8"){
  327 + key = keyArg;
  328 + }
  329 + else if(options.key.toLowerCase() === "hex"){
  330 + if(!/^[0-9a-zA-Z]+$/.test(keyArg)){
  331 + console.error("ERROR: Invalid Hex input");
  332 + process.exit(1);
  333 + }
  334 + else if(keyArg.length % 2 !== 0){
  335 + console.error("ERROR: Hex character count must be even");
  336 + process.exit(1);
  337 + }
  338 +
  339 + const {Hex} = require(resolve("Hex"));
  340 + key = Hex.parse(keyArg);
  341 + }
  342 + else if(options.key.toLowerCase() === "base64"){
  343 + const {Base64} = require(resolve("Base64"));
  344 + key = Base64.parse(keyArg);
  345 + }
  346 + else{
  347 + console.error("ERROR: unknown -key value");
  348 + process.exit(1);
  349 + }
  350 +
  351 + let outputEncoding;
  352 + if(options.out.toLowerCase() === "hex"){
  353 + outputEncoding = require(resolve("Hex")).Hex;
  354 + }
  355 + else if(options.out.toLowerCase() === "base64"){
  356 + outputEncoding = require(resolve("Base64")).Base64;
  357 + }
  358 + else{
  359 + console.error("ERROR: unknown -out value");
  360 + process.exit(1);
  361 + }
  362 +
  363 + const result = Hasher(message, key);
  364 + let output;
  365 + try{
  366 + output = result.toString(outputEncoding);
  367 + }
  368 + catch(e){
  369 + if(options.out === "utf8"){
  370 + console.error("ERROR: Byte array could not be recognized as UTF-8");
  371 + }
  372 + else{
  373 + console.error("ERROR: Failed to hash message");
  374 + }
  375 + process.exit(1);
  376 + }
  377 +
  378 + console.log(output);
  379 + process.exit(0);
  380 +}
  381 +
  382 +function doCipher(){
  383 + const encTypeArg = args[1];
  384 + const messageArg = args[2] || "";
  385 + const keyArg = args[3] || "";
  386 + const optionArgs = args.slice(4);
  387 + const options = {
  388 + msg: "utf8",
  389 + key: "utf8",
  390 + out: "", // default value will be set later
  391 + mode: "cbc",
  392 + pad: "pkcs7",
  393 + kdf: "pbkdf2",
  394 + iter: 10000,
  395 + hasher: "sha256"
  396 + };
  397 +
  398 + if(optionArgs){
  399 + for(let i=0;i<optionArgs.length;i++){
  400 + const o1 = optionArgs[i];
  401 + const o2 = optionArgs[i+1];
  402 + if(o1 === "-msg"){
  403 + if(!["hex", "base64", "utf8"].includes(o2)){
  404 + console.error("ERROR: Unknown -msg value");
  405 + console.error("");
  406 + console.log(manJsCryptoCipher);
  407 + process.exit(1);
  408 + }
  409 + options.msg = o2;
  410 + i += 1;
  411 + }
  412 + else if(o1 === "-key"){
  413 + if(!["hex", "base64", "utf8"].includes(o2)){
  414 + console.error("ERROR: Unknown -key value");
  415 + console.error("");
  416 + console.log(manJsCryptoCipher);
  417 + process.exit(1);
  418 + }
  419 + options.key = o2;
  420 + i += 1;
  421 + }
  422 + else if(o1 === "-out"){
  423 + if(!["hex", "base64", "utf8"].includes(o2)){
  424 + console.error("ERROR: Unknown -out value");
  425 + console.error("");
  426 + console.log(manJsCryptoCipher);
  427 + process.exit(1);
  428 + }
  429 + options.out = o2;
  430 + i += 1;
  431 + }
  432 + else if(o1 === "-mode"){
  433 + if(!["cbc", "ecb", "cfb", "ofb", "ctr"].includes(o2)){
  434 + console.error("ERROR: Unknown -mode value");
  435 + console.error("");
  436 + console.log(manJsCryptoCipher);
  437 + process.exit(1);
  438 + }
  439 + options.mode = o2;
  440 + i += 1;
  441 + }
  442 + else if(o1 === "-pad"){
  443 + if(!["ansix923", "iso10126", "iso97971", "nopadding", "pkcs7"].includes(o2)){
  444 + console.error("ERROR: Unknown -pad value");
  445 + console.error("");
  446 + console.log(manJsCryptoCipher);
  447 + process.exit(1);
  448 + }
  449 + options.pad = o2;
  450 + i += 1;
  451 + }
  452 + else if(o1 === "-kdf"){
  453 + if(!["pbkdf2", "evpkdf"].includes(o2)){
  454 + console.error("ERROR: Unknown -kdf value");
  455 + console.error("");
  456 + console.log(manJsCryptoCipher);
  457 + process.exit(1);
  458 + }
  459 + options.kdf = o2;
  460 + i += 1;
  461 + }
  462 + else if(o1 === "-kdfIter"){
  463 + if(isNaN(+o2) || !isFinite(+o2)){
  464 + console.error("ERROR: -iter value must be number");
  465 + console.error("");
  466 + console.log(manJsCryptoCipher);
  467 + process.exit(1);
  468 + }
  469 + options.iter = +o2;
  470 + i += 1;
  471 + }
  472 + else if(o1 === "-kdfHasher"){
  473 + if(!hashCommands.includes(o2.toLowerCase())){
  474 + console.error("ERROR: Unknown -kdf value");
  475 + console.error("");
  476 + console.log(manJsCryptoCipher);
  477 + process.exit(1);
  478 + }
  479 + options.hasher = o2.toLowerCase();
  480 + i += 1;
  481 + }
  482 + else{
  483 + console.error("ERROR: Unknown option");
  484 + console.error("");
  485 + console.log(manJsCryptoCipher);
  486 + process.exit(1);
  487 + }
  488 + }
  489 + }
  490 +
  491 + let Cipher;
  492 + switch (command.toLowerCase()){
  493 + case "aes": Cipher = require(resolve("AES")).AES; break;
  494 + case "des": Cipher = require(resolve("DES")).DES; break;
  495 + case "des3": Cipher = require(resolve("DES3")).DES3; break;
  496 + case "rabbit": Cipher = require(resolve("Rabbit ")).Rabbit; break;
  497 + case "rc4": Cipher = require(resolve("RC4")).RC4; break;
  498 + default:
  499 + console.error("ERROR: Unknown cipher");
  500 + console.error("");
  501 + console.log(manJsCryptoCipher);
  502 + process.exit(1);
  503 + }
  504 +
  505 + let encType;
  506 + if(["enc", "dec"].includes(encTypeArg)){
  507 + encType = encTypeArg;
  508 + }
  509 + else{
  510 + console.error("ERROR: Must specify enc/dec");
  511 + console.error("");
  512 + console.log(manJsCryptoCipher);
  513 + process.exit(1);
  514 + }
  515 +
  516 + let message;
  517 + if(encType === "enc"){
  518 + if(options.msg.toLowerCase() === "utf8"){
  519 + message = messageArg;
  520 + }
  521 + else if(options.msg.toLowerCase() === "hex"){
  522 + if(!/^[0-9a-fA-F]+$/.test(messageArg)){
  523 + console.error("ERROR: Invalid Hex input");
  524 + process.exit(1);
  525 + }
  526 + else if(messageArg.length % 2 !== 0){
  527 + console.error("ERROR: Hex character count must be even");
  528 + process.exit(1);
  529 + }
  530 +
  531 + const {Hex} = require(resolve("Hex"));
  532 + message = Hex.parse(messageArg);
  533 + }
  534 + else if(options.msg.toLowerCase() === "base64"){
  535 + const {Base64} = require(resolve("Base64"));
  536 + message = Base64.parse(messageArg);
  537 + }
  538 + else{
  539 + console.error("ERROR: unknown -msg value");
  540 + process.exit(1);
  541 + }
  542 + }
  543 + else{ // encType === "dec"
  544 + message = messageArg;
  545 + }
  546 +
  547 + let key;
  548 + if(options.key.toLowerCase() === "utf8"){
  549 + key = keyArg;
  550 + }
  551 + else if(options.key.toLowerCase() === "hex"){
  552 + if(!/^[0-9a-zA-Z]+$/.test(keyArg)){
  553 + console.error("ERROR: Invalid Hex input");
  554 + process.exit(1);
  555 + }
  556 + else if(keyArg.length % 2 !== 0){
  557 + console.error("ERROR: Hex character count must be even");
  558 + process.exit(1);
  559 + }
  560 +
  561 + const {Hex} = require(resolve("Hex"));
  562 + key = Hex.parse(keyArg);
  563 +
  564 + if(command === "aes" && key.nSigBytes % 4 !== 0){
  565 + console.error("ERROR: Key size for AES must be multiple of 32bit/4byte/1word");
  566 + process.exit(1);
  567 + }
  568 + else if(command === "des3" && ![8,16].includes(key.nSigBytes) && key.nSigBytes < 24){
  569 + console.error("ERROR: 3DES requires the key length to be 64, 128, 192 or >192 bits.");
  570 + process.exit(1);
  571 + }
  572 + }
  573 + else if(options.key.toLowerCase() === "base64"){
  574 + const {Base64} = require(resolve("Base64"));
  575 + key = Base64.parse(keyArg);
  576 +
  577 + if(command === "aes" && key.nSigBytes % 4 !== 0){
  578 + console.error("ERROR: Key size for AES must be multiple of 32bit/4byte/1word");
  579 + process.exit(1);
  580 + }
  581 + else if(command === "des3" && ![8,16].includes(key.nSigBytes) && key.nSigBytes < 24){
  582 + console.error("ERROR: 3DES requires the key length to be 64, 128, 192 or >192 bits.");
  583 + process.exit(1);
  584 + }
  585 + }
  586 + else{
  587 + console.error("ERROR: unknown -key value");
  588 + process.exit(1);
  589 + }
  590 +
  591 + // Decide -out default value
  592 + if(!options.out){
  593 + if(encType === "enc"){
  594 + options.out = "base64";
  595 + }
  596 + else{
  597 + options.out = "hex";
  598 + }
  599 + }
  600 + else if(encType === "enc" && options.out.toLowerCase() === "utf8"){
  601 + console.error("ERROR: '-out utf8' cannot be used on encryption");
  602 + process.exit(1);
  603 + }
  604 +
  605 + let outputEncoding;
  606 + if(options.out.toLowerCase() === "hex"){
  607 + outputEncoding = require(resolve("Hex")).Hex;
  608 + }
  609 + else if(options.out.toLowerCase() === "base64"){
  610 + outputEncoding = require(resolve("Base64")).Base64;
  611 + }
  612 + else if(options.out.toLowerCase() === "utf8"){
  613 + outputEncoding = require(resolve("Utf8")).Utf8;
  614 + }
  615 + else{
  616 + console.error("ERROR: unknown -out value");
  617 + process.exit(1);
  618 + }
  619 +
  620 + let mode;
  621 + if(options.mode.toLowerCase() === "cbc"){
  622 + mode = require(resolve("mode/CBC")).CBC;
  623 + }
  624 + else if(options.mode.toLowerCase() === "ecb"){
  625 + mode = require(resolve("mode/ECB")).ECB;
  626 + }
  627 + else if(options.mode.toLowerCase() === "ofb"){
  628 + mode = require(resolve("mode/OFB")).OFB;
  629 + }
  630 + else if(options.mode.toLowerCase() === "cfb"){
  631 + mode = require(resolve("mode/CFB")).CFB;
  632 + }
  633 + else if(options.mode.toLowerCase() === "ctr"){
  634 + mode = require(resolve("mode/CTR")).CTR;
  635 + }
  636 + else{
  637 + console.error("ERROR: unknown -mode value");
  638 + process.exit(1);
  639 + }
  640 +
  641 + let padding;
  642 + if(options.pad.toLowerCase() === "ansix923"){
  643 + padding = require(resolve("pad/AnsiX923")).AnsiX923;
  644 + }
  645 + else if(options.pad.toLowerCase() === "iso10126"){
  646 + padding = require(resolve("pad/ISO10126")).ISO10126;
  647 + }
  648 + else if(options.pad.toLowerCase() === "iso97971"){
  649 + padding = require(resolve("pad/ISO97971")).ISO97971;
  650 + }
  651 + else if(options.pad.toLowerCase() === "nopadding"){
  652 + padding = require(resolve("pad/NoPadding")).NoPadding;
  653 + }
  654 + else if(options.pad.toLowerCase() === "pkcs7"){
  655 + padding = require(resolve("pad/Pkcs7")).Pkcs7;
  656 + }
  657 + else if(options.pad.toLowerCase() === "zero"){
  658 + padding = require(resolve("pad/Zero")).Zero;
  659 + }
  660 + else{
  661 + console.error("ERROR: unknown -pad value");
  662 + process.exit(1);
  663 + }
  664 +
  665 + let kdfModule;
  666 + if(options.kdf.toLowerCase() === "pbkdf2"){
  667 + kdfModule = require(resolve("PBKDF2")).PBKDF2;
  668 + }
  669 + else if(options.kdf.toLowerCase() === "evpkdf"){
  670 + kdfModule = require(resolve("EvpKDF")).EvpKDF;
  671 + }
  672 + else{
  673 + console.error("ERROR: unknown -kdf value");
  674 + process.exit(1);
  675 + }
  676 +
  677 + let kdfIterations = options.iter;
  678 +
  679 + let kdfHasher;
  680 + switch (options.hasher.toLowerCase()){
  681 + case "md5": kdfHasher = require(resolve("MD5")).MD5; break;
  682 + case "sha1": kdfHasher = require(resolve("SHA1")).SHA1; break;
  683 + case "sha3": kdfHasher = require(resolve("SHA3")).SHA3; break;
  684 + case "sha224": kdfHasher = require(resolve("SHA224")).SHA224; break;
  685 + case "sha256": kdfHasher = require(resolve("SHA256")).SHA256; break;
  686 + case "sha384": kdfHasher = require(resolve("SHA384")).SHA384; break;
  687 + case "sha512": kdfHasher = require(resolve("SHA512")).SHA512; break;
  688 + case "ripemd160": kdfHasher = require(resolve("RIPEMD160")).RIPEMD160; break;
  689 + default:
  690 + console.error("ERROR: Unknown hash");
  691 + process.exit(1);
  692 + }
  693 +
  694 + let result;
  695 +
  696 + if(encType === "enc"){
  697 + result = Cipher.encrypt(message, key, {mode, padding, kdfModule, kdfIterations, kdfHasher});
  698 + }
  699 + else{
  700 + result = Cipher.decrypt(message, key, {mode, padding, kdfModule, kdfIterations, kdfHasher});
  701 + }
  702 +
  703 + let output;
  704 + try{
  705 + if(encType === "enc"){
  706 + if(options.out.toLowerCase() === "base64"){
  707 + output = result.toString();
  708 + }
  709 + else{
  710 + const {Base64} = require(resolve("Base64"));
  711 + const word = Base64.parse(result.toString());
  712 + output = word.toString(require(resolve("Hex")).Hex);
  713 + }
  714 + }
  715 + else{
  716 + output = result.toString(outputEncoding);
  717 + }
  718 + }
  719 + catch(e){
  720 + if(options.out === "utf8"){
  721 + console.error("ERROR: Byte array could not be recognized as UTF-8");
  722 + }
  723 + else{
  724 + console.error("ERROR: Failed to decrypt message");
  725 + }
  726 + process.exit(1);
  727 + }
  728 +
  729 + console.log(output);
  730 + process.exit(0);
  731 +}
\ No newline at end of file
... ...
  1 +import { CipherProps, PropsWithKey } from "./lib/algorithm/cipher/Cipher";
  2 +import type { Word32Array } from "./lib/Word32Array";
  3 +import { BlockCipher, BlockCipherProps } from "./lib/algorithm/cipher/BlockCipher";
  4 +import type { CipherParams } from "./lib/algorithm/cipher/CipherParams";
  5 +export interface AESProps extends BlockCipherProps {
  6 +}
  7 +export declare class AES extends BlockCipher {
  8 + static readonly keySize: number;
  9 + protected _props: PropsWithKey<AESProps>;
  10 + protected _nRounds: number;
  11 + protected _keyPriorReset: Word32Array | undefined;
  12 + protected _keySchedule: number[];
  13 + protected _invKeySchedule: number[];
  14 + constructor(props: PropsWithKey<AESProps>);
  15 + protected _doReset(): void;
  16 + encryptBlock(words: number[], offset: number): void;
  17 + decryptBlock(words: number[], offset: number): void;
  18 + protected _doCryptBlock(words: number[], offset: number, keySchedule: number[], subMix0: number[], subMix1: number[], subMix2: number[], subMix3: number[], sBox: number[]): void;
  19 + /**
  20 + * Creates this cipher in encryption mode.
  21 + *
  22 + * @param {Word32Array} key The key.
  23 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  24 + * @return {Cipher} A cipher instance.
  25 + * @example
  26 + * var cipher = AES.createEncryptor(keyWordArray, { iv: ivWordArray });
  27 + */
  28 + static createEncryptor(key: Word32Array, props?: Partial<CipherProps>): AES;
  29 + /**
  30 + * Creates this cipher in decryption mode.
  31 + *
  32 + * @param {Word32Array} key The key.
  33 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  34 + * @return {Cipher} A cipher instance.
  35 + * @example
  36 + * var cipher = AES.createDecryptor(keyWordArray, { iv: ivWordArray });
  37 + */
  38 + static createDecryptor(key: Word32Array, props?: Partial<CipherProps>): AES;
  39 + /**
  40 + * Encrypt a message with key
  41 + *
  42 + * @param {Word32Array|string} message
  43 + * @param {Word32Array|string} key
  44 + * @param {Partial<AESProps>?} props
  45 + * @example
  46 + * var encryptedMessage = AES.encrypt("test", "pass");
  47 + */
  48 + static encrypt(message: Word32Array | string, key: Word32Array | string, props?: Partial<AESProps>): CipherParams;
  49 + /**
  50 + * Encrypt a encrypted message with key
  51 + *
  52 + * @param {CipherParams|string} cipherParams
  53 + * @param {Word32Array|string} key
  54 + * @param {Partial<AESProps>?} props
  55 + * @example
  56 + * var encryptedMessage = AES.decrypt(cipherProps, "pass");
  57 + */
  58 + static decrypt(cipherParams: CipherParams | string, key: Word32Array | string, props?: Partial<AESProps>): Word32Array;
  59 +}
... ...
  1 +import { Cipher } from "./lib/algorithm/cipher/Cipher";
  2 +import { BlockCipher } from "./lib/algorithm/cipher/BlockCipher";
  3 +import { PasswordBasedCipher } from "./lib/algorithm/cipher/PasswordBasedCipher";
  4 +import { SerializableCipher } from "./lib/algorithm/cipher/SerializableCipher";
  5 +// Lookup tables
  6 +const SBOX = [];
  7 +const INV_SBOX = [];
  8 +const SUB_MIX_0 = [];
  9 +const SUB_MIX_1 = [];
  10 +const SUB_MIX_2 = [];
  11 +const SUB_MIX_3 = [];
  12 +const INV_SUB_MIX_0 = [];
  13 +const INV_SUB_MIX_1 = [];
  14 +const INV_SUB_MIX_2 = [];
  15 +const INV_SUB_MIX_3 = [];
  16 +(function computeLookupTables() {
  17 + // Compute double table
  18 + const d = [];
  19 + for (let i = 0; i < 256; i++) {
  20 + if (i < 128) {
  21 + d[i] = i << 1;
  22 + }
  23 + else {
  24 + d[i] = (i << 1) ^ 0x11b;
  25 + }
  26 + }
  27 + // Walk GF(2^8)
  28 + let x = 0;
  29 + let xi = 0;
  30 + for (let i = 0; i < 256; i++) {
  31 + // Compute sbox
  32 + let sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
  33 + sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;
  34 + SBOX[x] = sx;
  35 + INV_SBOX[sx] = x;
  36 + // Compute multiplication
  37 + const x2 = d[x];
  38 + const x4 = d[x2];
  39 + const x8 = d[x4];
  40 + // Compute sub bytes, mix columns tables
  41 + let t = (d[sx] * 0x101) ^ (sx * 0x1010100);
  42 + SUB_MIX_0[x] = (t << 24) | (t >>> 8);
  43 + SUB_MIX_1[x] = (t << 16) | (t >>> 16);
  44 + SUB_MIX_2[x] = (t << 8) | (t >>> 24);
  45 + SUB_MIX_3[x] = t;
  46 + // Compute inv sub bytes, inv mix columns tables
  47 + t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);
  48 + INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);
  49 + INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);
  50 + INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24);
  51 + INV_SUB_MIX_3[sx] = t;
  52 + // Compute next counter
  53 + if (!x) {
  54 + x = xi = 1;
  55 + }
  56 + else {
  57 + x = x2 ^ d[d[d[x8 ^ x2]]];
  58 + xi ^= d[d[xi]];
  59 + }
  60 + }
  61 +}());
  62 +// Precomputed Rcon lookup
  63 +const RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
  64 +export class AES extends BlockCipher {
  65 + constructor(props) {
  66 + super(props);
  67 + this._nRounds = 0;
  68 + this._keySchedule = [];
  69 + this._invKeySchedule = [];
  70 + this._props = props;
  71 + this._doReset();
  72 + }
  73 + _doReset() {
  74 + let t;
  75 + // Skip reset of nRounds has been set before and key did not change
  76 + if (this._nRounds && this._keyPriorReset === this._key) {
  77 + return;
  78 + }
  79 + // Shortcuts
  80 + const key = this._keyPriorReset = this._key;
  81 + const keyWords = key.words;
  82 + const keySize = key.nSigBytes / 4;
  83 + // Compute number of rounds
  84 + const nRounds = this._nRounds = keySize + 6;
  85 + // Compute number of key schedule rows
  86 + const ksRows = (nRounds + 1) * 4;
  87 + // Compute key schedule
  88 + const keySchedule = this._keySchedule = [];
  89 + for (let ksRow = 0; ksRow < ksRows; ksRow++) {
  90 + if (ksRow < keySize) {
  91 + keySchedule[ksRow] = keyWords[ksRow];
  92 + }
  93 + else {
  94 + t = keySchedule[ksRow - 1];
  95 + if (!(ksRow % keySize)) {
  96 + // Rot word
  97 + t = (t << 8) | (t >>> 24);
  98 + // Sub word
  99 + t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
  100 + // Mix Rcon
  101 + t ^= RCON[(ksRow / keySize) | 0] << 24;
  102 + }
  103 + else if (keySize > 6 && ksRow % keySize === 4) {
  104 + // Sub word
  105 + t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
  106 + }
  107 + keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
  108 + }
  109 + }
  110 + // Compute inv key schedule
  111 + this._invKeySchedule = [];
  112 + for (let invKsRow = 0; invKsRow < ksRows; invKsRow++) {
  113 + const ksRow = ksRows - invKsRow;
  114 + if (invKsRow % 4) {
  115 + t = keySchedule[ksRow];
  116 + }
  117 + else {
  118 + t = keySchedule[ksRow - 4];
  119 + }
  120 + if (invKsRow < 4 || ksRow <= 4) {
  121 + this._invKeySchedule[invKsRow] = t;
  122 + }
  123 + else {
  124 + this._invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^
  125 + INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
  126 + }
  127 + }
  128 + }
  129 + encryptBlock(words, offset) {
  130 + this._doCryptBlock(words, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
  131 + }
  132 + decryptBlock(words, offset) {
  133 + // Swap 2nd and 4th rows
  134 + let t = words[offset + 1];
  135 + words[offset + 1] = words[offset + 3];
  136 + words[offset + 3] = t;
  137 + this._doCryptBlock(words, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
  138 + // Inv swap 2nd and 4th rows
  139 + t = words[offset + 1];
  140 + words[offset + 1] = words[offset + 3];
  141 + words[offset + 3] = t;
  142 + }
  143 + _doCryptBlock(words, offset, keySchedule, subMix0, subMix1, subMix2, subMix3, sBox) {
  144 + // Shortcut
  145 + const nRounds = this._nRounds;
  146 + // Get input, add round key
  147 + let s0 = words[offset] ^ keySchedule[0];
  148 + let s1 = words[offset + 1] ^ keySchedule[1];
  149 + let s2 = words[offset + 2] ^ keySchedule[2];
  150 + let s3 = words[offset + 3] ^ keySchedule[3];
  151 + // Key schedule row counter
  152 + let ksRow = 4;
  153 + // Rounds
  154 + for (let round = 1; round < nRounds; round++) {
  155 + // Shift rows, sub bytes, mix columns, add round key
  156 + const _s0 = subMix0[s0 >>> 24] ^ subMix1[(s1 >>> 16) & 0xff]
  157 + ^ subMix2[(s2 >>> 8) & 0xff] ^ subMix3[s3 & 0xff] ^ keySchedule[ksRow++];
  158 + const _s1 = subMix0[s1 >>> 24] ^ subMix1[(s2 >>> 16) & 0xff]
  159 + ^ subMix2[(s3 >>> 8) & 0xff] ^ subMix3[s0 & 0xff] ^ keySchedule[ksRow++];
  160 + const _s2 = subMix0[s2 >>> 24] ^ subMix1[(s3 >>> 16) & 0xff]
  161 + ^ subMix2[(s0 >>> 8) & 0xff] ^ subMix3[s1 & 0xff] ^ keySchedule[ksRow++];
  162 + const _s3 = subMix0[s3 >>> 24] ^ subMix1[(s0 >>> 16) & 0xff]
  163 + ^ subMix2[(s1 >>> 8) & 0xff] ^ subMix3[s2 & 0xff] ^ keySchedule[ksRow++];
  164 + // Update state
  165 + s0 = _s0;
  166 + s1 = _s1;
  167 + s2 = _s2;
  168 + s3 = _s3;
  169 + }
  170 + // Shift rows, sub bytes, add round key
  171 + const t0 = ((sBox[s0 >>> 24] << 24) | (sBox[(s1 >>> 16) & 0xff] << 16)
  172 + | (sBox[(s2 >>> 8) & 0xff] << 8) | sBox[s3 & 0xff]) ^ keySchedule[ksRow++];
  173 + const t1 = ((sBox[s1 >>> 24] << 24) | (sBox[(s2 >>> 16) & 0xff] << 16)
  174 + | (sBox[(s3 >>> 8) & 0xff] << 8) | sBox[s0 & 0xff]) ^ keySchedule[ksRow++];
  175 + const t2 = ((sBox[s2 >>> 24] << 24) | (sBox[(s3 >>> 16) & 0xff] << 16)
  176 + | (sBox[(s0 >>> 8) & 0xff] << 8) | sBox[s1 & 0xff]) ^ keySchedule[ksRow++];
  177 + const t3 = ((sBox[s3 >>> 24] << 24) | (sBox[(s0 >>> 16) & 0xff] << 16)
  178 + | (sBox[(s1 >>> 8) & 0xff] << 8) | sBox[s2 & 0xff]) ^ keySchedule[ksRow++];
  179 + // Set output
  180 + words[offset] = t0;
  181 + words[offset + 1] = t1;
  182 + words[offset + 2] = t2;
  183 + words[offset + 3] = t3;
  184 + }
  185 + /**
  186 + * Creates this cipher in encryption mode.
  187 + *
  188 + * @param {Word32Array} key The key.
  189 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  190 + * @return {Cipher} A cipher instance.
  191 + * @example
  192 + * var cipher = AES.createEncryptor(keyWordArray, { iv: ivWordArray });
  193 + */
  194 + static createEncryptor(key, props) {
  195 + props = typeof props === "undefined" ? {} : props;
  196 + return new AES(Object.assign(Object.assign({}, props), { key, transformMode: Cipher.ENC_TRANSFORM_MODE }));
  197 + }
  198 + /**
  199 + * Creates this cipher in decryption mode.
  200 + *
  201 + * @param {Word32Array} key The key.
  202 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  203 + * @return {Cipher} A cipher instance.
  204 + * @example
  205 + * var cipher = AES.createDecryptor(keyWordArray, { iv: ivWordArray });
  206 + */
  207 + static createDecryptor(key, props) {
  208 + props = typeof props === "undefined" ? {} : props;
  209 + return new AES(Object.assign(Object.assign({}, props), { key, transformMode: Cipher.DEC_TRANSFORM_MODE }));
  210 + }
  211 + /**
  212 + * Encrypt a message with key
  213 + *
  214 + * @param {Word32Array|string} message
  215 + * @param {Word32Array|string} key
  216 + * @param {Partial<AESProps>?} props
  217 + * @example
  218 + * var encryptedMessage = AES.encrypt("test", "pass");
  219 + */
  220 + static encrypt(message, key, props) {
  221 + if (typeof key === "string") {
  222 + return PasswordBasedCipher.encrypt(AES, message, key, props);
  223 + }
  224 + if (key.nSigBytes % 4 !== 0) {
  225 + throw new Error("Key size must be multiple of 32bit/4byte/1word");
  226 + }
  227 + return SerializableCipher.encrypt(AES, message, key, props);
  228 + }
  229 + /**
  230 + * Encrypt a encrypted message with key
  231 + *
  232 + * @param {CipherParams|string} cipherParams
  233 + * @param {Word32Array|string} key
  234 + * @param {Partial<AESProps>?} props
  235 + * @example
  236 + * var encryptedMessage = AES.decrypt(cipherProps, "pass");
  237 + */
  238 + static decrypt(cipherParams, key, props) {
  239 + if (typeof key === "string") {
  240 + return PasswordBasedCipher.decrypt(AES, cipherParams, key, props);
  241 + }
  242 + if (key.nSigBytes % 4 !== 0) {
  243 + throw new Error("Key size must be multiple of 32bit/4byte/1word");
  244 + }
  245 + return SerializableCipher.decrypt(AES, cipherParams, key, props);
  246 + }
  247 +}
  248 +AES.keySize = 256 / 32;
... ...
  1 +export { Base64 } from "./lib/encoder/Base64";
... ...
  1 +export { Base64 } from "./lib/encoder/Base64";
... ...
  1 +import { Word32Array } from "./lib/Word32Array";
  2 +import { BlockCipher } from "./lib/algorithm/cipher/BlockCipher";
  3 +export declare type CBCMACProps = {
  4 + Cipher: typeof BlockCipher;
  5 +};
  6 +export declare function CBCMAC(plainText: Word32Array | string, associatedData: Word32Array | string, key: Word32Array | string, iv: Word32Array | null, tagLength?: number, props?: Partial<CBCMACProps>): Word32Array;
... ...
  1 +import { Utf8 } from "./lib/encoder/Utf8";
  2 +import { Word32Array } from "./lib/Word32Array";
  3 +import { AES } from "./AES";
  4 +import { CCM } from "./mode/CCM";
  5 +export function CBCMAC(plainText, associatedData, key, iv, tagLength, props) {
  6 + const Cipher = (props && props.Cipher) ? props.Cipher : AES;
  7 + const K = typeof key === "string" ? Utf8.parse(key) : key;
  8 + const N = iv ? iv : new Word32Array([0, 0]);
  9 + const A = typeof associatedData === "string" ? Utf8.parse(associatedData) : associatedData;
  10 + const P = typeof plainText === "string" ? Utf8.parse(plainText) : plainText;
  11 + const t = tagLength || 16;
  12 + return CCM.mac(Cipher, K, N, A, P, t);
  13 +}
... ...
  1 +export { CipherParams } from "./lib/algorithm/cipher/CipherParams";
... ...
  1 +export { CipherParams } from "./lib/algorithm/cipher/CipherParams";
... ...
  1 +import { BlockCipher, BlockCipherProps } from "./lib/algorithm/cipher/BlockCipher";
  2 +import { CipherProps, PropsWithKey } from "./lib/algorithm/cipher/Cipher";
  3 +import { Word32Array } from "./lib/Word32Array";
  4 +import { CipherParams } from "./lib/algorithm/cipher/CipherParams";
  5 +export interface DESProps extends BlockCipherProps {
  6 +}
  7 +export declare class DES extends BlockCipher {
  8 + static readonly keySize: number;
  9 + static readonly ivSize: number;
  10 + protected _blockSize: number;
  11 + _props: PropsWithKey<DESProps>;
  12 + protected _subKeys: number[][];
  13 + protected _invSubKeys: number[][];
  14 + protected _lBlock: number;
  15 + protected _rBlock: number;
  16 + constructor(props: PropsWithKey<DESProps>);
  17 + protected _doReset(): void;
  18 + encryptBlock(words: number[], offset: number): void;
  19 + decryptBlock(words: number[], offset: number): void;
  20 + protected _doCryptoBlock(words: number[], offset: number, subKeys: number[][]): void;
  21 + protected _exchangeLR(offset: number, mask: number): void;
  22 + protected _exchangeRL(offset: number, mask: number): void;
  23 + /**
  24 + * Creates this cipher in encryption mode.
  25 + *
  26 + * @param {Word32Array} key The key.
  27 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  28 + * @return {Cipher} A cipher instance.
  29 + * @example
  30 + * var cipher = DES.createEncryptor(keyWordArray, { iv: ivWordArray });
  31 + */
  32 + static createEncryptor(key: Word32Array, props?: Partial<CipherProps>): DES;
  33 + /**
  34 + * Creates this cipher in decryption mode.
  35 + *
  36 + * @param {Word32Array} key The key.
  37 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  38 + * @return {Cipher} A cipher instance.
  39 + * @example
  40 + * var cipher = DES.createDecryptor(keyWordArray, { iv: ivWordArray });
  41 + */
  42 + static createDecryptor(key: Word32Array, props?: Partial<CipherProps>): DES;
  43 + /**
  44 + * Encrypt a message with key
  45 + *
  46 + * @param {Word32Array|string} message
  47 + * @param {Word32Array|string} key
  48 + * @param {Partial<AESProps>?} props
  49 + * @example
  50 + * var encryptedMessage = DES.encrypt("test", "pass");
  51 + */
  52 + static encrypt(message: Word32Array | string, key: Word32Array | string, props?: Partial<DESProps>): CipherParams;
  53 + /**
  54 + * Encrypt a encrypted message with key
  55 + *
  56 + * @param {CipherParams} cipherText
  57 + * @param {Word32Array|string} key
  58 + * @param {Partial<AESProps>?} props
  59 + * @example
  60 + * var encryptedMessage = DES.decrypt(cipherProps, "pass");
  61 + */
  62 + static decrypt(cipherText: CipherParams, key: Word32Array | string, props?: Partial<DESProps>): Word32Array;
  63 +}
... ...
  1 +// Permuted Choice 1 constants
  2 +import { BlockCipher } from "./lib/algorithm/cipher/BlockCipher";
  3 +import { Cipher } from "./lib/algorithm/cipher/Cipher";
  4 +import { PasswordBasedCipher } from "./lib/algorithm/cipher/PasswordBasedCipher";
  5 +import { SerializableCipher } from "./lib/algorithm/cipher/SerializableCipher";
  6 +const PC1 = [
  7 + 57, 49, 41, 33, 25, 17, 9, 1,
  8 + 58, 50, 42, 34, 26, 18, 10, 2,
  9 + 59, 51, 43, 35, 27, 19, 11, 3,
  10 + 60, 52, 44, 36, 63, 55, 47, 39,
  11 + 31, 23, 15, 7, 62, 54, 46, 38,
  12 + 30, 22, 14, 6, 61, 53, 45, 37,
  13 + 29, 21, 13, 5, 28, 20, 12, 4
  14 +];
  15 +// Permuted Choice 2 constants
  16 +const PC2 = [
  17 + 14, 17, 11, 24, 1, 5,
  18 + 3, 28, 15, 6, 21, 10,
  19 + 23, 19, 12, 4, 26, 8,
  20 + 16, 7, 27, 20, 13, 2,
  21 + 41, 52, 31, 37, 47, 55,
  22 + 30, 40, 51, 45, 33, 48,
  23 + 44, 49, 39, 56, 34, 53,
  24 + 46, 42, 50, 36, 29, 32
  25 +];
  26 +// Cumulative bit shift constants
  27 +const BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28];
  28 +// SBOXes and round permutation constants
  29 +const SBOX_P = [
  30 + {
  31 + 0x0: 0x808200,
  32 + 0x10000000: 0x8000,
  33 + 0x20000000: 0x808002,
  34 + 0x30000000: 0x2,
  35 + 0x40000000: 0x200,
  36 + 0x50000000: 0x808202,
  37 + 0x60000000: 0x800202,
  38 + 0x70000000: 0x800000,
  39 + 0x80000000: 0x202,
  40 + 0x90000000: 0x800200,
  41 + 0xa0000000: 0x8200,
  42 + 0xb0000000: 0x808000,
  43 + 0xc0000000: 0x8002,
  44 + 0xd0000000: 0x800002,
  45 + 0xe0000000: 0x0,
  46 + 0xf0000000: 0x8202,
  47 + 0x8000000: 0x0,
  48 + 0x18000000: 0x808202,
  49 + 0x28000000: 0x8202,
  50 + 0x38000000: 0x8000,
  51 + 0x48000000: 0x808200,
  52 + 0x58000000: 0x200,
  53 + 0x68000000: 0x808002,
  54 + 0x78000000: 0x2,
  55 + 0x88000000: 0x800200,
  56 + 0x98000000: 0x8200,
  57 + 0xa8000000: 0x808000,
  58 + 0xb8000000: 0x800202,
  59 + 0xc8000000: 0x800002,
  60 + 0xd8000000: 0x8002,
  61 + 0xe8000000: 0x202,
  62 + 0xf8000000: 0x800000,
  63 + 0x1: 0x8000,
  64 + 0x10000001: 0x2,
  65 + 0x20000001: 0x808200,
  66 + 0x30000001: 0x800000,
  67 + 0x40000001: 0x808002,
  68 + 0x50000001: 0x8200,
  69 + 0x60000001: 0x200,
  70 + 0x70000001: 0x800202,
  71 + 0x80000001: 0x808202,
  72 + 0x90000001: 0x808000,
  73 + 0xa0000001: 0x800002,
  74 + 0xb0000001: 0x8202,
  75 + 0xc0000001: 0x202,
  76 + 0xd0000001: 0x800200,
  77 + 0xe0000001: 0x8002,
  78 + 0xf0000001: 0x0,
  79 + 0x8000001: 0x808202,
  80 + 0x18000001: 0x808000,
  81 + 0x28000001: 0x800000,
  82 + 0x38000001: 0x200,
  83 + 0x48000001: 0x8000,
  84 + 0x58000001: 0x800002,
  85 + 0x68000001: 0x2,
  86 + 0x78000001: 0x8202,
  87 + 0x88000001: 0x8002,
  88 + 0x98000001: 0x800202,
  89 + 0xa8000001: 0x202,
  90 + 0xb8000001: 0x808200,
  91 + 0xc8000001: 0x800200,
  92 + 0xd8000001: 0x0,
  93 + 0xe8000001: 0x8200,
  94 + 0xf8000001: 0x808002
  95 + },
  96 + {
  97 + 0x0: 0x40084010,
  98 + 0x1000000: 0x4000,
  99 + 0x2000000: 0x80000,
  100 + 0x3000000: 0x40080010,
  101 + 0x4000000: 0x40000010,
  102 + 0x5000000: 0x40084000,
  103 + 0x6000000: 0x40004000,
  104 + 0x7000000: 0x10,
  105 + 0x8000000: 0x84000,
  106 + 0x9000000: 0x40004010,
  107 + 0xa000000: 0x40000000,
  108 + 0xb000000: 0x84010,
  109 + 0xc000000: 0x80010,
  110 + 0xd000000: 0x0,
  111 + 0xe000000: 0x4010,
  112 + 0xf000000: 0x40080000,
  113 + 0x800000: 0x40004000,
  114 + 0x1800000: 0x84010,
  115 + 0x2800000: 0x10,
  116 + 0x3800000: 0x40004010,
  117 + 0x4800000: 0x40084010,
  118 + 0x5800000: 0x40000000,
  119 + 0x6800000: 0x80000,
  120 + 0x7800000: 0x40080010,
  121 + 0x8800000: 0x80010,
  122 + 0x9800000: 0x0,
  123 + 0xa800000: 0x4000,
  124 + 0xb800000: 0x40080000,
  125 + 0xc800000: 0x40000010,
  126 + 0xd800000: 0x84000,
  127 + 0xe800000: 0x40084000,
  128 + 0xf800000: 0x4010,
  129 + 0x10000000: 0x0,
  130 + 0x11000000: 0x40080010,
  131 + 0x12000000: 0x40004010,
  132 + 0x13000000: 0x40084000,
  133 + 0x14000000: 0x40080000,
  134 + 0x15000000: 0x10,
  135 + 0x16000000: 0x84010,
  136 + 0x17000000: 0x4000,
  137 + 0x18000000: 0x4010,
  138 + 0x19000000: 0x80000,
  139 + 0x1a000000: 0x80010,
  140 + 0x1b000000: 0x40000010,
  141 + 0x1c000000: 0x84000,
  142 + 0x1d000000: 0x40004000,
  143 + 0x1e000000: 0x40000000,
  144 + 0x1f000000: 0x40084010,
  145 + 0x10800000: 0x84010,
  146 + 0x11800000: 0x80000,
  147 + 0x12800000: 0x40080000,
  148 + 0x13800000: 0x4000,
  149 + 0x14800000: 0x40004000,
  150 + 0x15800000: 0x40084010,
  151 + 0x16800000: 0x10,
  152 + 0x17800000: 0x40000000,
  153 + 0x18800000: 0x40084000,
  154 + 0x19800000: 0x40000010,
  155 + 0x1a800000: 0x40004010,
  156 + 0x1b800000: 0x80010,
  157 + 0x1c800000: 0x0,
  158 + 0x1d800000: 0x4010,
  159 + 0x1e800000: 0x40080010,
  160 + 0x1f800000: 0x84000
  161 + },
  162 + {
  163 + 0x0: 0x104,
  164 + 0x100000: 0x0,
  165 + 0x200000: 0x4000100,
  166 + 0x300000: 0x10104,
  167 + 0x400000: 0x10004,
  168 + 0x500000: 0x4000004,
  169 + 0x600000: 0x4010104,
  170 + 0x700000: 0x4010000,
  171 + 0x800000: 0x4000000,
  172 + 0x900000: 0x4010100,
  173 + 0xa00000: 0x10100,
  174 + 0xb00000: 0x4010004,
  175 + 0xc00000: 0x4000104,
  176 + 0xd00000: 0x10000,
  177 + 0xe00000: 0x4,
  178 + 0xf00000: 0x100,
  179 + 0x80000: 0x4010100,
  180 + 0x180000: 0x4010004,
  181 + 0x280000: 0x0,
  182 + 0x380000: 0x4000100,
  183 + 0x480000: 0x4000004,
  184 + 0x580000: 0x10000,
  185 + 0x680000: 0x10004,
  186 + 0x780000: 0x104,
  187 + 0x880000: 0x4,
  188 + 0x980000: 0x100,
  189 + 0xa80000: 0x4010000,
  190 + 0xb80000: 0x10104,
  191 + 0xc80000: 0x10100,
  192 + 0xd80000: 0x4000104,
  193 + 0xe80000: 0x4010104,
  194 + 0xf80000: 0x4000000,
  195 + 0x1000000: 0x4010100,
  196 + 0x1100000: 0x10004,
  197 + 0x1200000: 0x10000,
  198 + 0x1300000: 0x4000100,
  199 + 0x1400000: 0x100,
  200 + 0x1500000: 0x4010104,
  201 + 0x1600000: 0x4000004,
  202 + 0x1700000: 0x0,
  203 + 0x1800000: 0x4000104,
  204 + 0x1900000: 0x4000000,
  205 + 0x1a00000: 0x4,
  206 + 0x1b00000: 0x10100,
  207 + 0x1c00000: 0x4010000,
  208 + 0x1d00000: 0x104,
  209 + 0x1e00000: 0x10104,
  210 + 0x1f00000: 0x4010004,
  211 + 0x1080000: 0x4000000,
  212 + 0x1180000: 0x104,
  213 + 0x1280000: 0x4010100,
  214 + 0x1380000: 0x0,
  215 + 0x1480000: 0x10004,
  216 + 0x1580000: 0x4000100,
  217 + 0x1680000: 0x100,
  218 + 0x1780000: 0x4010004,
  219 + 0x1880000: 0x10000,
  220 + 0x1980000: 0x4010104,
  221 + 0x1a80000: 0x10104,
  222 + 0x1b80000: 0x4000004,
  223 + 0x1c80000: 0x4000104,
  224 + 0x1d80000: 0x4010000,
  225 + 0x1e80000: 0x4,
  226 + 0x1f80000: 0x10100
  227 + },
  228 + {
  229 + 0x0: 0x80401000,
  230 + 0x10000: 0x80001040,
  231 + 0x20000: 0x401040,
  232 + 0x30000: 0x80400000,
  233 + 0x40000: 0x0,
  234 + 0x50000: 0x401000,
  235 + 0x60000: 0x80000040,
  236 + 0x70000: 0x400040,
  237 + 0x80000: 0x80000000,
  238 + 0x90000: 0x400000,
  239 + 0xa0000: 0x40,
  240 + 0xb0000: 0x80001000,
  241 + 0xc0000: 0x80400040,
  242 + 0xd0000: 0x1040,
  243 + 0xe0000: 0x1000,
  244 + 0xf0000: 0x80401040,
  245 + 0x8000: 0x80001040,
  246 + 0x18000: 0x40,
  247 + 0x28000: 0x80400040,
  248 + 0x38000: 0x80001000,
  249 + 0x48000: 0x401000,
  250 + 0x58000: 0x80401040,
  251 + 0x68000: 0x0,
  252 + 0x78000: 0x80400000,
  253 + 0x88000: 0x1000,
  254 + 0x98000: 0x80401000,
  255 + 0xa8000: 0x400000,
  256 + 0xb8000: 0x1040,
  257 + 0xc8000: 0x80000000,
  258 + 0xd8000: 0x400040,
  259 + 0xe8000: 0x401040,
  260 + 0xf8000: 0x80000040,
  261 + 0x100000: 0x400040,
  262 + 0x110000: 0x401000,
  263 + 0x120000: 0x80000040,
  264 + 0x130000: 0x0,
  265 + 0x140000: 0x1040,
  266 + 0x150000: 0x80400040,
  267 + 0x160000: 0x80401000,
  268 + 0x170000: 0x80001040,
  269 + 0x180000: 0x80401040,
  270 + 0x190000: 0x80000000,
  271 + 0x1a0000: 0x80400000,
  272 + 0x1b0000: 0x401040,
  273 + 0x1c0000: 0x80001000,
  274 + 0x1d0000: 0x400000,
  275 + 0x1e0000: 0x40,
  276 + 0x1f0000: 0x1000,
  277 + 0x108000: 0x80400000,
  278 + 0x118000: 0x80401040,
  279 + 0x128000: 0x0,
  280 + 0x138000: 0x401000,
  281 + 0x148000: 0x400040,
  282 + 0x158000: 0x80000000,
  283 + 0x168000: 0x80001040,
  284 + 0x178000: 0x40,
  285 + 0x188000: 0x80000040,
  286 + 0x198000: 0x1000,
  287 + 0x1a8000: 0x80001000,
  288 + 0x1b8000: 0x80400040,
  289 + 0x1c8000: 0x1040,
  290 + 0x1d8000: 0x80401000,
  291 + 0x1e8000: 0x400000,
  292 + 0x1f8000: 0x401040
  293 + },
  294 + {
  295 + 0x0: 0x80,
  296 + 0x1000: 0x1040000,
  297 + 0x2000: 0x40000,
  298 + 0x3000: 0x20000000,
  299 + 0x4000: 0x20040080,
  300 + 0x5000: 0x1000080,
  301 + 0x6000: 0x21000080,
  302 + 0x7000: 0x40080,
  303 + 0x8000: 0x1000000,
  304 + 0x9000: 0x20040000,
  305 + 0xa000: 0x20000080,
  306 + 0xb000: 0x21040080,
  307 + 0xc000: 0x21040000,
  308 + 0xd000: 0x0,
  309 + 0xe000: 0x1040080,
  310 + 0xf000: 0x21000000,
  311 + 0x800: 0x1040080,
  312 + 0x1800: 0x21000080,
  313 + 0x2800: 0x80,
  314 + 0x3800: 0x1040000,
  315 + 0x4800: 0x40000,
  316 + 0x5800: 0x20040080,
  317 + 0x6800: 0x21040000,
  318 + 0x7800: 0x20000000,
  319 + 0x8800: 0x20040000,
  320 + 0x9800: 0x0,
  321 + 0xa800: 0x21040080,
  322 + 0xb800: 0x1000080,
  323 + 0xc800: 0x20000080,
  324 + 0xd800: 0x21000000,
  325 + 0xe800: 0x1000000,
  326 + 0xf800: 0x40080,
  327 + 0x10000: 0x40000,
  328 + 0x11000: 0x80,
  329 + 0x12000: 0x20000000,
  330 + 0x13000: 0x21000080,
  331 + 0x14000: 0x1000080,
  332 + 0x15000: 0x21040000,
  333 + 0x16000: 0x20040080,
  334 + 0x17000: 0x1000000,
  335 + 0x18000: 0x21040080,
  336 + 0x19000: 0x21000000,
  337 + 0x1a000: 0x1040000,
  338 + 0x1b000: 0x20040000,
  339 + 0x1c000: 0x40080,
  340 + 0x1d000: 0x20000080,
  341 + 0x1e000: 0x0,
  342 + 0x1f000: 0x1040080,
  343 + 0x10800: 0x21000080,
  344 + 0x11800: 0x1000000,
  345 + 0x12800: 0x1040000,
  346 + 0x13800: 0x20040080,
  347 + 0x14800: 0x20000000,
  348 + 0x15800: 0x1040080,
  349 + 0x16800: 0x80,
  350 + 0x17800: 0x21040000,
  351 + 0x18800: 0x40080,
  352 + 0x19800: 0x21040080,
  353 + 0x1a800: 0x0,
  354 + 0x1b800: 0x21000000,
  355 + 0x1c800: 0x1000080,
  356 + 0x1d800: 0x40000,
  357 + 0x1e800: 0x20040000,
  358 + 0x1f800: 0x20000080
  359 + },
  360 + {
  361 + 0x0: 0x10000008,
  362 + 0x100: 0x2000,
  363 + 0x200: 0x10200000,
  364 + 0x300: 0x10202008,
  365 + 0x400: 0x10002000,
  366 + 0x500: 0x200000,
  367 + 0x600: 0x200008,
  368 + 0x700: 0x10000000,
  369 + 0x800: 0x0,
  370 + 0x900: 0x10002008,
  371 + 0xa00: 0x202000,
  372 + 0xb00: 0x8,
  373 + 0xc00: 0x10200008,
  374 + 0xd00: 0x202008,
  375 + 0xe00: 0x2008,
  376 + 0xf00: 0x10202000,
  377 + 0x80: 0x10200000,
  378 + 0x180: 0x10202008,
  379 + 0x280: 0x8,
  380 + 0x380: 0x200000,
  381 + 0x480: 0x202008,
  382 + 0x580: 0x10000008,
  383 + 0x680: 0x10002000,
  384 + 0x780: 0x2008,
  385 + 0x880: 0x200008,
  386 + 0x980: 0x2000,
  387 + 0xa80: 0x10002008,
  388 + 0xb80: 0x10200008,
  389 + 0xc80: 0x0,
  390 + 0xd80: 0x10202000,
  391 + 0xe80: 0x202000,
  392 + 0xf80: 0x10000000,
  393 + 0x1000: 0x10002000,
  394 + 0x1100: 0x10200008,
  395 + 0x1200: 0x10202008,
  396 + 0x1300: 0x2008,
  397 + 0x1400: 0x200000,
  398 + 0x1500: 0x10000000,
  399 + 0x1600: 0x10000008,
  400 + 0x1700: 0x202000,
  401 + 0x1800: 0x202008,
  402 + 0x1900: 0x0,
  403 + 0x1a00: 0x8,
  404 + 0x1b00: 0x10200000,
  405 + 0x1c00: 0x2000,
  406 + 0x1d00: 0x10002008,
  407 + 0x1e00: 0x10202000,
  408 + 0x1f00: 0x200008,
  409 + 0x1080: 0x8,
  410 + 0x1180: 0x202000,
  411 + 0x1280: 0x200000,
  412 + 0x1380: 0x10000008,
  413 + 0x1480: 0x10002000,
  414 + 0x1580: 0x2008,
  415 + 0x1680: 0x10202008,
  416 + 0x1780: 0x10200000,
  417 + 0x1880: 0x10202000,
  418 + 0x1980: 0x10200008,
  419 + 0x1a80: 0x2000,
  420 + 0x1b80: 0x202008,
  421 + 0x1c80: 0x200008,
  422 + 0x1d80: 0x0,
  423 + 0x1e80: 0x10000000,
  424 + 0x1f80: 0x10002008
  425 + },
  426 + {
  427 + 0x0: 0x100000,
  428 + 0x10: 0x2000401,
  429 + 0x20: 0x400,
  430 + 0x30: 0x100401,
  431 + 0x40: 0x2100401,
  432 + 0x50: 0x0,
  433 + 0x60: 0x1,
  434 + 0x70: 0x2100001,
  435 + 0x80: 0x2000400,
  436 + 0x90: 0x100001,
  437 + 0xa0: 0x2000001,
  438 + 0xb0: 0x2100400,
  439 + 0xc0: 0x2100000,
  440 + 0xd0: 0x401,
  441 + 0xe0: 0x100400,
  442 + 0xf0: 0x2000000,
  443 + 0x8: 0x2100001,
  444 + 0x18: 0x0,
  445 + 0x28: 0x2000401,
  446 + 0x38: 0x2100400,
  447 + 0x48: 0x100000,
  448 + 0x58: 0x2000001,
  449 + 0x68: 0x2000000,
  450 + 0x78: 0x401,
  451 + 0x88: 0x100401,
  452 + 0x98: 0x2000400,
  453 + 0xa8: 0x2100000,
  454 + 0xb8: 0x100001,
  455 + 0xc8: 0x400,
  456 + 0xd8: 0x2100401,
  457 + 0xe8: 0x1,
  458 + 0xf8: 0x100400,
  459 + 0x100: 0x2000000,
  460 + 0x110: 0x100000,
  461 + 0x120: 0x2000401,
  462 + 0x130: 0x2100001,
  463 + 0x140: 0x100001,
  464 + 0x150: 0x2000400,
  465 + 0x160: 0x2100400,
  466 + 0x170: 0x100401,
  467 + 0x180: 0x401,
  468 + 0x190: 0x2100401,
  469 + 0x1a0: 0x100400,
  470 + 0x1b0: 0x1,
  471 + 0x1c0: 0x0,
  472 + 0x1d0: 0x2100000,
  473 + 0x1e0: 0x2000001,
  474 + 0x1f0: 0x400,
  475 + 0x108: 0x100400,
  476 + 0x118: 0x2000401,
  477 + 0x128: 0x2100001,
  478 + 0x138: 0x1,
  479 + 0x148: 0x2000000,
  480 + 0x158: 0x100000,
  481 + 0x168: 0x401,
  482 + 0x178: 0x2100400,
  483 + 0x188: 0x2000001,
  484 + 0x198: 0x2100000,
  485 + 0x1a8: 0x0,
  486 + 0x1b8: 0x2100401,
  487 + 0x1c8: 0x100401,
  488 + 0x1d8: 0x400,
  489 + 0x1e8: 0x2000400,
  490 + 0x1f8: 0x100001
  491 + },
  492 + {
  493 + 0x0: 0x8000820,
  494 + 0x1: 0x20000,
  495 + 0x2: 0x8000000,
  496 + 0x3: 0x20,
  497 + 0x4: 0x20020,
  498 + 0x5: 0x8020820,
  499 + 0x6: 0x8020800,
  500 + 0x7: 0x800,
  501 + 0x8: 0x8020000,
  502 + 0x9: 0x8000800,
  503 + 0xa: 0x20800,
  504 + 0xb: 0x8020020,
  505 + 0xc: 0x820,
  506 + 0xd: 0x0,
  507 + 0xe: 0x8000020,
  508 + 0xf: 0x20820,
  509 + 0x80000000: 0x800,
  510 + 0x80000001: 0x8020820,
  511 + 0x80000002: 0x8000820,
  512 + 0x80000003: 0x8000000,
  513 + 0x80000004: 0x8020000,
  514 + 0x80000005: 0x20800,
  515 + 0x80000006: 0x20820,
  516 + 0x80000007: 0x20,
  517 + 0x80000008: 0x8000020,
  518 + 0x80000009: 0x820,
  519 + 0x8000000a: 0x20020,
  520 + 0x8000000b: 0x8020800,
  521 + 0x8000000c: 0x0,
  522 + 0x8000000d: 0x8020020,
  523 + 0x8000000e: 0x8000800,
  524 + 0x8000000f: 0x20000,
  525 + 0x10: 0x20820,
  526 + 0x11: 0x8020800,
  527 + 0x12: 0x20,
  528 + 0x13: 0x800,
  529 + 0x14: 0x8000800,
  530 + 0x15: 0x8000020,
  531 + 0x16: 0x8020020,
  532 + 0x17: 0x20000,
  533 + 0x18: 0x0,
  534 + 0x19: 0x20020,
  535 + 0x1a: 0x8020000,
  536 + 0x1b: 0x8000820,
  537 + 0x1c: 0x8020820,
  538 + 0x1d: 0x20800,
  539 + 0x1e: 0x820,
  540 + 0x1f: 0x8000000,
  541 + 0x80000010: 0x20000,
  542 + 0x80000011: 0x800,
  543 + 0x80000012: 0x8020020,
  544 + 0x80000013: 0x20820,
  545 + 0x80000014: 0x20,
  546 + 0x80000015: 0x8020000,
  547 + 0x80000016: 0x8000000,
  548 + 0x80000017: 0x8000820,
  549 + 0x80000018: 0x8020820,
  550 + 0x80000019: 0x8000020,
  551 + 0x8000001a: 0x8000800,
  552 + 0x8000001b: 0x0,
  553 + 0x8000001c: 0x20800,
  554 + 0x8000001d: 0x820,
  555 + 0x8000001e: 0x20020,
  556 + 0x8000001f: 0x8020800
  557 + }
  558 +];
  559 +// Masks that select the SBOX input
  560 +const SBOX_MASK = [
  561 + 0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000,
  562 + 0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f
  563 +];
  564 +export class DES extends BlockCipher {
  565 + constructor(props) {
  566 + super(props);
  567 + this._blockSize = 64 / 32;
  568 + this._subKeys = [];
  569 + this._invSubKeys = [];
  570 + this._lBlock = 0;
  571 + this._rBlock = 0;
  572 + this._props = props;
  573 + this._doReset();
  574 + }
  575 + _doReset() {
  576 + // Shortcuts
  577 + const key = this._key;
  578 + const keyWords = key.words;
  579 + // Select 56 bits according to PC1
  580 + const keyBits = [];
  581 + for (let i = 0; i < 56; i++) {
  582 + const keyBitPos = PC1[i] - 1;
  583 + keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1;
  584 + }
  585 + // Assemble 16 subkeys
  586 + const subKeys = this._subKeys = [];
  587 + for (let nSubKey = 0; nSubKey < 16; nSubKey++) {
  588 + // Create subkey
  589 + const subKey = subKeys[nSubKey] = [];
  590 + // Shortcut
  591 + const bitShift = BIT_SHIFTS[nSubKey];
  592 + // Select 48 bits according to PC2
  593 + for (let i = 0; i < 24; i++) {
  594 + // Select from the left 28 key bits
  595 + subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6);
  596 + // Select from the right 28 key bits
  597 + subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6);
  598 + }
  599 + // Since each subkey is applied to an expanded 32-bit input,
  600 + // the subkey can be broken into 8 values scaled to 32-bits,
  601 + // which allows the key to be used without expansion
  602 + subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31);
  603 + for (let i = 1; i < 7; i++) {
  604 + subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3);
  605 + }
  606 + subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27);
  607 + }
  608 + // Compute inverse subkeys
  609 + this._invSubKeys = [];
  610 + for (let i = 0; i < 16; i++) {
  611 + this._invSubKeys[i] = subKeys[15 - i];
  612 + }
  613 + }
  614 + encryptBlock(words, offset) {
  615 + this._doCryptoBlock(words, offset, this._subKeys);
  616 + }
  617 + decryptBlock(words, offset) {
  618 + this._doCryptoBlock(words, offset, this._invSubKeys);
  619 + }
  620 + _doCryptoBlock(words, offset, subKeys) {
  621 + // Get input
  622 + this._lBlock = words[offset];
  623 + this._rBlock = words[offset + 1];
  624 + // Initial permutation
  625 + this._exchangeLR(4, 0x0f0f0f0f);
  626 + this._exchangeLR(16, 0x0000ffff);
  627 + this._exchangeRL(2, 0x33333333);
  628 + this._exchangeRL(8, 0x00ff00ff);
  629 + this._exchangeLR(1, 0x55555555);
  630 + // Rounds
  631 + for (let round = 0; round < 16; round++) {
  632 + // Shortcuts
  633 + const subKey = subKeys[round];
  634 + const lBlock = this._lBlock;
  635 + const rBlock = this._rBlock;
  636 + // Feistel function
  637 + let f = 0;
  638 + for (let i = 0; i < 8; i++) {
  639 + const s = ((rBlock ^ subKey[i]) & SBOX_MASK[i]);
  640 + f |= SBOX_P[i][s >>> 0];
  641 + }
  642 + this._lBlock = rBlock;
  643 + this._rBlock = lBlock ^ f;
  644 + }
  645 + // Undo swap from last round
  646 + const t = this._lBlock;
  647 + this._lBlock = this._rBlock;
  648 + this._rBlock = t;
  649 + // Final permutation
  650 + this._exchangeLR(1, 0x55555555);
  651 + this._exchangeRL(8, 0x00ff00ff);
  652 + this._exchangeRL(2, 0x33333333);
  653 + this._exchangeLR(16, 0x0000ffff);
  654 + this._exchangeLR(4, 0x0f0f0f0f);
  655 + // Set output
  656 + words[offset] = this._lBlock;
  657 + words[offset + 1] = this._rBlock;
  658 + }
  659 + _exchangeLR(offset, mask) {
  660 + const t = ((this._lBlock >>> offset) ^ this._rBlock) & mask;
  661 + this._rBlock ^= t;
  662 + this._lBlock ^= t << offset;
  663 + }
  664 + _exchangeRL(offset, mask) {
  665 + const t = ((this._rBlock >>> offset) ^ this._lBlock) & mask;
  666 + this._lBlock ^= t;
  667 + this._rBlock ^= t << offset;
  668 + }
  669 + /**
  670 + * Creates this cipher in encryption mode.
  671 + *
  672 + * @param {Word32Array} key The key.
  673 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  674 + * @return {Cipher} A cipher instance.
  675 + * @example
  676 + * var cipher = DES.createEncryptor(keyWordArray, { iv: ivWordArray });
  677 + */
  678 + static createEncryptor(key, props) {
  679 + props = typeof props === "undefined" ? {} : props;
  680 + return new DES(Object.assign(Object.assign({}, props), { key, transformMode: Cipher.ENC_TRANSFORM_MODE }));
  681 + }
  682 + /**
  683 + * Creates this cipher in decryption mode.
  684 + *
  685 + * @param {Word32Array} key The key.
  686 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  687 + * @return {Cipher} A cipher instance.
  688 + * @example
  689 + * var cipher = DES.createDecryptor(keyWordArray, { iv: ivWordArray });
  690 + */
  691 + static createDecryptor(key, props) {
  692 + props = typeof props === "undefined" ? {} : props;
  693 + return new DES(Object.assign(Object.assign({}, props), { key, transformMode: Cipher.DEC_TRANSFORM_MODE }));
  694 + }
  695 + /**
  696 + * Encrypt a message with key
  697 + *
  698 + * @param {Word32Array|string} message
  699 + * @param {Word32Array|string} key
  700 + * @param {Partial<AESProps>?} props
  701 + * @example
  702 + * var encryptedMessage = DES.encrypt("test", "pass");
  703 + */
  704 + static encrypt(message, key, props) {
  705 + if (typeof key === "string") {
  706 + return PasswordBasedCipher.encrypt(DES, message, key, props);
  707 + }
  708 + return SerializableCipher.encrypt(DES, message, key, props);
  709 + }
  710 + /**
  711 + * Encrypt a encrypted message with key
  712 + *
  713 + * @param {CipherParams} cipherText
  714 + * @param {Word32Array|string} key
  715 + * @param {Partial<AESProps>?} props
  716 + * @example
  717 + * var encryptedMessage = DES.decrypt(cipherProps, "pass");
  718 + */
  719 + static decrypt(cipherText, key, props) {
  720 + if (typeof key === "string") {
  721 + return PasswordBasedCipher.decrypt(DES, cipherText, key, props);
  722 + }
  723 + return SerializableCipher.decrypt(DES, cipherText, key, props);
  724 + }
  725 +}
  726 +DES.keySize = 64 / 32;
  727 +DES.ivSize = 64 / 32;
... ...
  1 +import { BlockCipher, BlockCipherProps } from "./lib/algorithm/cipher/BlockCipher";
  2 +import { CipherProps, PropsWithKey } from "./lib/algorithm/cipher/Cipher";
  3 +import { DES } from "./DES";
  4 +import { Word32Array } from "./lib/Word32Array";
  5 +import { CipherParams } from "./lib/algorithm/cipher/CipherParams";
  6 +export interface DES3Props extends BlockCipherProps {
  7 +}
  8 +export declare class DES3 extends BlockCipher {
  9 + static readonly keySize: number;
  10 + static readonly ivSize: number;
  11 + protected _blockSize: number;
  12 + protected _des1: DES;
  13 + protected _des2: DES;
  14 + protected _des3: DES;
  15 + constructor(props: PropsWithKey<DES3Props>);
  16 + protected _get3DES(): DES[];
  17 + protected _doReset(): void;
  18 + encryptBlock(words: number[], offset: number): void;
  19 + decryptBlock(words: number[], offset: number): void;
  20 + /**
  21 + * Creates this cipher in encryption mode.
  22 + *
  23 + * @param {Word32Array} key The key.
  24 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  25 + * @return {Cipher} A cipher instance.
  26 + * @example
  27 + * var cipher = DES3.createEncryptor(keyWordArray, { iv: ivWordArray });
  28 + */
  29 + static createEncryptor(key: Word32Array, props?: Partial<CipherProps>): DES3;
  30 + /**
  31 + * Creates this cipher in decryption mode.
  32 + *
  33 + * @param {Word32Array} key The key.
  34 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  35 + * @return {Cipher} A cipher instance.
  36 + * @example
  37 + * var cipher = DES3.createDecryptor(keyWordArray, { iv: ivWordArray });
  38 + */
  39 + static createDecryptor(key: Word32Array, props?: Partial<CipherProps>): DES3;
  40 + /**
  41 + * Encrypt a message with key
  42 + *
  43 + * @param {Word32Array|string} message
  44 + * @param {Word32Array|string} key
  45 + * @param {Partial<AESProps>?} props
  46 + * @example
  47 + * var encryptedMessage = DES3.encrypt("test", "pass");
  48 + */
  49 + static encrypt(message: Word32Array | string, key: Word32Array | string, props?: Partial<DES3Props>): CipherParams;
  50 + /**
  51 + * Encrypt a encrypted message with key
  52 + *
  53 + * @param {CipherParams} cipherText
  54 + * @param {Word32Array|string} key
  55 + * @param {Partial<AESProps>?} props
  56 + * @example
  57 + * var encryptedMessage = DES3.decrypt(cipherProps, "pass");
  58 + */
  59 + static decrypt(cipherText: CipherParams, key: Word32Array | string, props?: Partial<DES3Props>): Word32Array;
  60 +}
... ...
  1 +import { SerializableCipher } from "./lib/algorithm/cipher/SerializableCipher";
  2 +import { BlockCipher } from "./lib/algorithm/cipher/BlockCipher";
  3 +import { Cipher } from "./lib/algorithm/cipher/Cipher";
  4 +import { DES } from "./DES";
  5 +import { Word32Array } from "./lib/Word32Array";
  6 +import { PasswordBasedCipher } from "./lib/algorithm/cipher/PasswordBasedCipher";
  7 +export class DES3 extends BlockCipher {
  8 + constructor(props) {
  9 + super(props);
  10 + this._blockSize = 64 / 32;
  11 + this._props = props;
  12 + const TripleDES = this._get3DES();
  13 + // Create DES instances
  14 + this._des1 = TripleDES[0];
  15 + this._des2 = TripleDES[1];
  16 + this._des3 = TripleDES[2];
  17 + }
  18 + _get3DES() {
  19 + // Shortcuts
  20 + const key = this._key;
  21 + const keyWords = key.words;
  22 + // Make sure the key length is valid (64, 128 or >= 192 bit)
  23 + if (keyWords.length !== 2 && keyWords.length !== 4 && keyWords.length < 6) {
  24 + throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");
  25 + }
  26 + // Extend the key according to the keying options defined in 3DES standard
  27 + const key1 = keyWords.slice(0, 2);
  28 + const key2 = keyWords.length < 4 ? keyWords.slice(0, 2) : keyWords.slice(2, 4);
  29 + const key3 = keyWords.length < 6 ? keyWords.slice(0, 2) : keyWords.slice(4, 6);
  30 + // Create DES instances
  31 + const des1 = DES.createEncryptor(new Word32Array(key1));
  32 + const des2 = DES.createEncryptor(new Word32Array(key2));
  33 + const des3 = DES.createEncryptor(new Word32Array(key3));
  34 + return [des1, des2, des3];
  35 + }
  36 + _doReset() {
  37 + const TripleDES = this._get3DES();
  38 + // Create DES instances
  39 + this._des1 = TripleDES[0];
  40 + this._des2 = TripleDES[1];
  41 + this._des3 = TripleDES[2];
  42 + }
  43 + encryptBlock(words, offset) {
  44 + this._des1.encryptBlock(words, offset);
  45 + this._des2.decryptBlock(words, offset);
  46 + this._des3.encryptBlock(words, offset);
  47 + }
  48 + decryptBlock(words, offset) {
  49 + this._des3.decryptBlock(words, offset);
  50 + this._des2.encryptBlock(words, offset);
  51 + this._des1.decryptBlock(words, offset);
  52 + }
  53 + /**
  54 + * Creates this cipher in encryption mode.
  55 + *
  56 + * @param {Word32Array} key The key.
  57 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  58 + * @return {Cipher} A cipher instance.
  59 + * @example
  60 + * var cipher = DES3.createEncryptor(keyWordArray, { iv: ivWordArray });
  61 + */
  62 + static createEncryptor(key, props) {
  63 + props = typeof props === "undefined" ? {} : props;
  64 + return new DES3(Object.assign(Object.assign({}, props), { key, transformMode: Cipher.ENC_TRANSFORM_MODE }));
  65 + }
  66 + /**
  67 + * Creates this cipher in decryption mode.
  68 + *
  69 + * @param {Word32Array} key The key.
  70 + * @param {Partial<CipherProps>?} props (Optional) The configuration options to use for this operation.
  71 + * @return {Cipher} A cipher instance.
  72 + * @example
  73 + * var cipher = DES3.createDecryptor(keyWordArray, { iv: ivWordArray });
  74 + */
  75 + static createDecryptor(key, props) {
  76 + props = typeof props === "undefined" ? {} : props;
  77 + return new DES3(Object.assign(Object.assign({}, props), { key, transformMode: Cipher.DEC_TRANSFORM_MODE }));
  78 + }
  79 + /**
  80 + * Encrypt a message with key
  81 + *
  82 + * @param {Word32Array|string} message
  83 + * @param {Word32Array|string} key
  84 + * @param {Partial<AESProps>?} props
  85 + * @example
  86 + * var encryptedMessage = DES3.encrypt("test", "pass");
  87 + */
  88 + static encrypt(message, key, props) {
  89 + if (typeof key === "string") {
  90 + return PasswordBasedCipher.encrypt(DES3, message, key, props);
  91 + }
  92 + return SerializableCipher.encrypt(DES3, message, key, props);
  93 + }
  94 + /**
  95 + * Encrypt a encrypted message with key
  96 + *
  97 + * @param {CipherParams} cipherText
  98 + * @param {Word32Array|string} key
  99 + * @param {Partial<AESProps>?} props
  100 + * @example
  101 + * var encryptedMessage = DES3.decrypt(cipherProps, "pass");
  102 + */
  103 + static decrypt(cipherText, key, props) {
  104 + if (typeof key === "string") {
  105 + return PasswordBasedCipher.decrypt(DES3, cipherText, key, props);
  106 + }
  107 + return SerializableCipher.decrypt(DES3, cipherText, key, props);
  108 + }
  109 +}
  110 +DES3.keySize = 192 / 32;
  111 +DES3.ivSize = 64 / 32;
... ...
  1 +export { EvpKDF } from "./lib/algorithm/cipher/kdf/module/EvpKDF";
... ...
  1 +export { EvpKDF } from "./lib/algorithm/cipher/kdf/module/EvpKDF";
... ...
  1 +import { Word32Array } from "./lib/Word32Array";
  2 +import { BlockCipher } from "./lib/algorithm/cipher/BlockCipher";
  3 +export declare type GMACProps = {
  4 + Cipher: typeof BlockCipher;
  5 +};
  6 +export declare function GMAC(message: Word32Array | string, key: Word32Array | string, iv?: Word32Array, tagLength?: number, props?: Partial<GMACProps>): Word32Array;
... ...
  1 +import { Utf8 } from "./lib/encoder/Utf8";
  2 +import { Word32Array } from "./lib/Word32Array";
  3 +import { AES } from "./AES";
  4 +import { GCM } from "./mode/GCM";
  5 +export function GMAC(message, key, iv, tagLength, props) {
  6 + const aad = typeof message === "string" ? Utf8.parse(message) : message;
  7 + const initializingVector = iv ? iv : new Word32Array([0, 0, 0, 0]);
  8 + const Cipher = (props && props.Cipher) ? props.Cipher : AES;
  9 + const wKey = typeof key === "string" ? Utf8.parse(key) : key;
  10 + const t = tagLength || 16;
  11 + return GCM.mac(Cipher, wKey, initializingVector, aad, undefined, t);
  12 +}
... ...
  1 +export { Hex } from "./lib/encoder/Hex";
... ...
  1 +export { Hex } from "./lib/encoder/Hex";
... ...
  1 +import type { Hasher } from "./lib/algorithm/Hasher";
  2 +import type { Word32Array } from "./lib/Word32Array";
  3 +export declare class Hmac {
  4 + private _hasher;
  5 + private _oKey;
  6 + private _iKey;
  7 + constructor(hasher: Hasher, key: Word32Array | string);
  8 + /**
  9 + * Resets this Hmac to its initial state.
  10 + *
  11 + * @example
  12 + * hmacHasher.reset();
  13 + */
  14 + reset(): void;
  15 + /**
  16 + * Updates this Hmac with a message.
  17 + *
  18 + * @param {Word32Array|string} messageUpdate The message to append.
  19 + * @return {Hmac} This Hmac instance.
  20 + * @example
  21 + * hmacHasher.update('message');
  22 + * hmacHasher.update(wordArray);
  23 + */
  24 + update(messageUpdate: Word32Array | string): this;
  25 + /**
  26 + * Finalizes the Hmac computation.
  27 + * Note that the finalize operation is effectively a destructive, read-once operation.
  28 + *
  29 + * @param {Word32Array|string} messageUpdate (Optional) A final message update.
  30 + * @return {Word32Array} The Hmac.
  31 + * @example
  32 + * var hmac = hmacHasher.finalize();
  33 + * var hmac = hmacHasher.finalize('message');
  34 + * var hmac = hmacHasher.finalize(wordArray);
  35 + */
  36 + finalize(messageUpdate: Word32Array | string): Word32Array;
  37 +}
... ...
  1 +import { Utf8 } from "./lib/encoder/Utf8";
  2 +export class Hmac {
  3 + constructor(hasher, key) {
  4 + this._hasher = hasher;
  5 + // Convert string to WordArray, else assume WordArray already
  6 + if (typeof key == "string") {
  7 + key = Utf8.parse(key);
  8 + }
  9 + const hasherBlockSize = hasher.blockSize;
  10 + const hasherBlockSizeBytes = hasherBlockSize * 4;
  11 + // Allow arbitrary length keys
  12 + if (key.nSigBytes > hasherBlockSizeBytes) {
  13 + key = hasher.finalize(key);
  14 + }
  15 + // Clamp excess bits
  16 + key.clamp();
  17 + const oKey = this._oKey = key.clone();
  18 + const iKey = this._iKey = key.clone();
  19 + const oKeyWords = oKey.words;
  20 + const iKeyWords = iKey.words;
  21 + for (let i = 0; i < hasherBlockSize; i++) {
  22 + oKeyWords[i] ^= 0x5c5c5c5c;
  23 + iKeyWords[i] ^= 0x36363636;
  24 + }
  25 + iKey.nSigBytes = hasherBlockSizeBytes;
  26 + oKey.nSigBytes = hasherBlockSizeBytes;
  27 + // Set initial values
  28 + this.reset();
  29 + }
  30 + /**
  31 + * Resets this Hmac to its initial state.
  32 + *
  33 + * @example
  34 + * hmacHasher.reset();
  35 + */
  36 + reset() {
  37 + this._hasher.reset();
  38 + this._hasher.update(this._iKey);
  39 + }
  40 + /**
  41 + * Updates this Hmac with a message.
  42 + *
  43 + * @param {Word32Array|string} messageUpdate The message to append.
  44 + * @return {Hmac} This Hmac instance.
  45 + * @example
  46 + * hmacHasher.update('message');
  47 + * hmacHasher.update(wordArray);
  48 + */
  49 + update(messageUpdate) {
  50 + this._hasher.update(messageUpdate);
  51 + return this;
  52 + }
  53 + /**
  54 + * Finalizes the Hmac computation.
  55 + * Note that the finalize operation is effectively a destructive, read-once operation.
  56 + *
  57 + * @param {Word32Array|string} messageUpdate (Optional) A final message update.
  58 + * @return {Word32Array} The Hmac.
  59 + * @example
  60 + * var hmac = hmacHasher.finalize();
  61 + * var hmac = hmacHasher.finalize('message');
  62 + * var hmac = hmacHasher.finalize(wordArray);
  63 + */
  64 + finalize(messageUpdate) {
  65 + const innerHash = this._hasher.finalize(messageUpdate);
  66 + this._hasher.reset();
  67 + return this._hasher.finalize(this._oKey.clone().concat(innerHash));
  68 + }
  69 +}
... ...
  1 +import type { Word32Array } from "./lib/Word32Array";
  2 +export declare function HmacMD5(message: Word32Array | string, key: Word32Array | string): Word32Array;
... ...
  1 +import { Hmac } from "./Hmac";
  2 +import { MD5 } from "./MD5";
  3 +export function HmacMD5(message, key) {
  4 + return new Hmac(new MD5(), key).finalize(message);
  5 +}
... ...
  1 +import type { Word32Array } from "./lib/Word32Array";
  2 +export declare function HmacSHA1(message: Word32Array | string, key: Word32Array | string): Word32Array;
... ...
  1 +import { Hmac } from "./Hmac";
  2 +import { SHA1 } from "./SHA1";
  3 +export function HmacSHA1(message, key) {
  4 + return new Hmac(new SHA1(), key).finalize(message);
  5 +}
... ...
注册登录 后发表评论