85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
memcpy(combinedPassphraseItems, _passphrase.items, passphraseLength);
if (_keyFile != nil)
memcpy(combinedPassphraseItems + passphraseLength,
_keyFile.items, _keyFile.count);
outputItems = _output.mutableItems;
of_scrypt(8, 524288, 2, siteHash.digest, [siteHash.class digestSize],
combinedPassphraseItems, combinedPassphraseLength, outputItems,
_length, true);
/*
* This has a bias, however, this is what scrypt-genpass does and the
* legacy mode wants to be compatible to scrypt-genpass.
*/
outputItems[0] = "abcdefghijklmnopqrstuvwxyz"[outputItems[0] % 26];
outputItems[1] = "0123456789"[outputItems[1] % 10];
|
>
>
>
>
>
|
>
|
>
|
>
>
|
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
memcpy(combinedPassphraseItems, _passphrase.items, passphraseLength);
if (_keyFile != nil)
memcpy(combinedPassphraseItems + passphraseLength,
_keyFile.items, _keyFile.count);
outputItems = _output.mutableItems;
of_scrypt((of_scrypt_parameters_t){
.blockSize = 8,
.costFactor = 524288,
.parallelization = 2,
.salt = siteHash.digest,
.saltLength = [siteHash.class digestSize],
.password = combinedPassphraseItems,
.passwordLength = combinedPassphraseLength,
.key = outputItems,
.keyLength = _length,
.allowsSwappableMemory = false
});
/*
* This has a bias, however, this is what scrypt-genpass does and the
* legacy mode wants to be compatible to scrypt-genpass.
*/
outputItems[0] = "abcdefghijklmnopqrstuvwxyz"[outputItems[0] % 26];
outputItems[1] = "0123456789"[outputItems[1] % 10];
|