MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / testStreamCipher

Function testStreamCipher

examples/crypt/cryptblockcipher/main.js:114–127  ·  view source on GitHub ↗
(name, keyStr, plain, iv, counter, expected)

Source from the content-addressed store, hash-verified

112}
113
114function testStreamCipher(name, keyStr, plain, iv, counter, expected)
115{
116 let key = ("string" == typeof keyStr) ? ArrayBuffer.fromString(keyStr) : keyStr;
117
118 if ("string" == typeof plain)
119 plain += "";
120
121 let result = (new StreamCipher(name, key, iv, counter)).encrypt(plain);
122
123 if (Hex.toString(result) != expected)
124 trace(`${name} fail\n`);
125 else
126 trace(`${name} pass\n`);
127}

Callers 1

main.jsFile · 0.85

Calls 3

fromStringMethod · 0.80
encryptMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected