MCPcopy
hub / github.com/dcodeIO/bcrypt.js / _ekskey

Function _ekskey

index.js:900–929  ·  view source on GitHub ↗

* Expensive key schedule Blowfish. * @param {Array. } data * @param {Array. } key * @param {Array. } P * @param {Array. } S * @inner

(data, key, P, S)

Source from the content-addressed store, hash-verified

898 * @inner
899 */
900function _ekskey(data, key, P, S) {
901 var offp = 0,
902 lr = [0, 0],
903 plen = P.length,
904 slen = S.length,
905 sw;
906 for (var i = 0; i < plen; i++)
907 (sw = _streamtoword(key, offp)), (offp = sw.offp), (P[i] = P[i] ^ sw.key);
908 offp = 0;
909 for (i = 0; i < plen; i += 2)
910 (sw = _streamtoword(data, offp)),
911 (offp = sw.offp),
912 (lr[0] ^= sw.key),
913 (sw = _streamtoword(data, offp)),
914 (offp = sw.offp),
915 (lr[1] ^= sw.key),
916 (lr = _encipher(lr, 0, P, S)),
917 (P[i] = lr[0]),
918 (P[i + 1] = lr[1]);
919 for (i = 0; i < slen; i += 2)
920 (sw = _streamtoword(data, offp)),
921 (offp = sw.offp),
922 (lr[0] ^= sw.key),
923 (sw = _streamtoword(data, offp)),
924 (offp = sw.offp),
925 (lr[1] ^= sw.key),
926 (lr = _encipher(lr, 0, P, S)),
927 (S[i] = lr[0]),
928 (S[i + 1] = lr[1]);
929}
930
931/**
932 * Internaly crypts a string.

Callers 1

_cryptFunction · 0.85

Calls 2

_streamtowordFunction · 0.85
_encipherFunction · 0.85

Tested by

no test coverage detected