# HG changeset patch # User Laman # Date 2019-06-29 16:42:59 # Node ID f425e00a94c63fe2f0b57352d485cf12e826992e # Parent 9f2498ffdd4e9aa540bde66155a49e29a0305df0 bundling with Rollup diff --git a/crypto.html b/dist/crypto.html rename from crypto.html rename to dist/crypto.html --- a/crypto.html +++ b/dist/crypto.html @@ -1,12 +1,12 @@
- - + + diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,8 @@ +module.exports = { + input: 'src/main.js', + output: { + file: 'dist/main.js', + format: 'iife', + name: "cryptoJS" + } +}; diff --git a/spec/test/utilSpec.js b/spec/test/utilSpec.js --- a/spec/test/utilSpec.js +++ b/spec/test/utilSpec.js @@ -1,8 +1,8 @@ /* global expect */ describe("Util",function(){ - var util = require("../../util.js"); - var utf=[ // https://tools.ietf.org/html/rfc3629#page-8 + let util=require("../../src/util.js"); + let utf=[ // https://tools.ietf.org/html/rfc3629#page-8 ["",[]], ["abc",[97,98,99]], ["å",[195,165]], diff --git a/blake.js b/src/blake.js rename from blake.js rename to src/blake.js --- a/blake.js +++ b/src/blake.js @@ -12,7 +12,7 @@ function rrot(x,shift){ return ((x>>>shift)|(x<<(32-shift)))&MASK; } -function BLAKE2S(outputLen=32,key=[]){ +export function BLAKE2S(outputLen=32,key=[]){ this._buffer=[]; this._dataLen=[0,0]; // low, high this._outputLen=outputLen; @@ -85,25 +85,8 @@ BLAKE2S.prototype._mix=function(arr,ia,i arr[ia]=a; arr[ib]=b; arr[ic]=c; arr[id]=d; }; -function blake2s(data,outputLen=32,key=[]){ +export function blake2s(data,outputLen=32,key=[]){ let h=new BLAKE2S(outputLen,key); for(let i=0;i