Skip to content

cronfox/snow2cipher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Pure javascript implementation of Snow 2.0

Create by @cronfox .

Usage

const SnowCipher = require("snow2cipher")

let SC1 = new SnowCipher(
	128, //(128|256), keySize
    new Uint8Array([0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa]), //key, if use in mabinogi , please use Int8Array.
    new Uint32Array([0,0,0,0])//[IV3,IV2,IV1,IV0] ivTable
)

SC1.generateKeyStream()

/*
Clocks the cipher 16 times and returns 16 words of keystream symbols in keystream_block.
return Uint32Array([
	0xE00982F5,
	0x25F02054,
	0x214992D8,
	0x706F2B20,
	0xDA585E5B,
	0x85E2746D,
	0x09F22681,
	0xB2749407,
	0x1D120231,
	0x82D9CCDF,
	0x7562671C,
	0xA19B884F,
	0x89572EAB,
	0x9EBBB511,
	0x85F42F7D,
	0xD5D4B51C	
])
*/

let SC = new SnowCipher(
	128,
    new Uint8Array([0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa]),
    new Uint32Array([0,0,0,0])
)

SC.singleClock()
//return keystream symbol(uint32 number),0xE00982F5

Just generate key stream, non encrypt/decrypt export.

Releases

No releases published

Packages

 
 
 

Contributors