Changeset - e2095e3881bf
[Not reviewed]
default
0 9 0
Laman - 3 years ago 2022-04-01 13:09:18

reformated with more whitespace
1 file changed with 3 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/blake.js
Show inline comments
 
@@ -80,15 +80,17 @@ BLAKE2S.prototype._compress=function(las
 

	
 
BLAKE2S.prototype._mix=function(arr,ia,ib,ic,id,x,y){
 
	let a=arr[ia], b=arr[ib], c=arr[ic], d=arr[id];
 
	a=(a+b+x)&MASK; d=rrot(d^a,16);
 
	c=(c+d)&MASK; b=rrot(b^c,12);
 
	a=(a+b+y)&MASK; d=rrot(d^a,8);
 
	c=(c+d)&MASK; b=rrot(b^c,7);
 
	arr[ia]=a; arr[ib]=b; arr[ic]=c; arr[id]=d;
 
};
 

	
 
export function blake2s(data,outputLen=32,key=[]){
 
	let h=new BLAKE2S(outputLen,key);
 
	for(let i=0;i<data.length;i+=BLOCK_LEN){h.update(data.slice(i,i+BLOCK_LEN));}
 
	for (let i = 0; i < data.length; i += BLOCK_LEN) {
 
		h.update(data.slice(i, i + BLOCK_LEN));
 
	}
 
	return h.digest();
 
}
0 comments (0 inline, 0 general)