72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
|
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,
of_scrypt(8, 524288, 2, siteHash.digest, [siteHash.class digestSize],
combinedPassphraseItems, combinedPassphraseLength, outputItems,
_length, true);
.saltLength = [siteHash.class digestSize],
.password = combinedPassphraseItems,
.passwordLength = combinedPassphraseLength,
.key = outputItems,
.keyLength = _length,
.allowsSwappableMemory = false
});
for (size_t i = 0; i < _length; i++)
outputItems[i] =
"123456789"
"abcdefghijkmnopqrstuvwxyz"
"ABCDEFGHJKLMNPQRSTUVWXYZ"
"#$%-=?"[outputItems[i] & 0x3F];
|