1.1 --- a/MYCryptor.m Tue Apr 07 10:56:58 2009 -0700
1.2 +++ b/MYCryptor.m Sat Apr 18 18:12:06 2009 -0700
1.3 @@ -57,11 +57,14 @@
1.4 fromPassphrase: (NSString*)passphrase
1.5 salt: (id)salt
1.6 {
1.7 + // This follows algorithm PBKDF1 from PKCS#5 v2.0, with Hash=SHA-256 and c=13.
1.8 Assert(passphrase);
1.9 Assert(salt);
1.10 passphrase = $sprintf(@"MYCrypto|%@|%@", passphrase, salt);
1.11 size_t lengthInBytes = (lengthInBits + 7)/8;
1.12 MYDigest *digest = [[passphrase dataUsingEncoding: NSUTF8StringEncoding] my_SHA256Digest];
1.13 + for (int i=0; i<12; i++)
1.14 + digest = digest.asData.my_SHA256Digest;
1.15 if (lengthInBytes <= digest.length)
1.16 return [digest.asData subdataWithRange: NSMakeRange(0,lengthInBytes)];
1.17 else
1.18 @@ -126,7 +129,7 @@
1.19
1.20 - (BOOL) _outputBytes: (const void*)bytes length: (size_t)length {
1.21 if (_outputStream) {
1.22 - NSInteger written = [_outputStream write: bytes maxLength: length];
1.23 + size_t written = [_outputStream write: bytes maxLength: length];
1.24 if (written < 0) {
1.25 self.error = _outputStream.streamError;
1.26 if (_error)