From 06c62f70ed9ec3556f58036de5fd283bd109c454 Mon Sep 17 00:00:00 2001 From: Maarten Billemont Date: Tue, 16 Sep 2014 00:45:39 -0400 Subject: [PATCH] Fixes to V0 algorithm debug log output. --- MasterPassword/ObjC/MPAlgorithmV0.m | 8 ++++---- MasterPassword/ObjC/MPAlgorithmV1.m | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/MasterPassword/ObjC/MPAlgorithmV0.m b/MasterPassword/ObjC/MPAlgorithmV0.m index d7a2baee..46d11bfc 100644 --- a/MasterPassword/ObjC/MPAlgorithmV0.m +++ b/MasterPassword/ObjC/MPAlgorithmV0.m @@ -367,9 +367,9 @@ uint32_t ncounter = htonl( counter ), nnameLength = htonl( name.length ); NSData *counterBytes = [NSData dataWithBytes:&ncounter length:sizeof( ncounter )]; NSData *nameLengthBytes = [NSData dataWithBytes:&nnameLength length:sizeof( nnameLength )]; - NSString *scope = [self scopeForVariant:variant];; + NSString *scope = [self scopeForVariant:variant]; trc( @"seed from: hmac-sha256(%@, %@ | %@ | %@ | %@)", - [key.keyData encodeBase64], scope, [nameLengthBytes encodeHex], name, [counterBytes encodeHex] ); + [[key keyID] encodeHex], scope, [nameLengthBytes encodeHex], name, [counterBytes encodeHex] ); NSData *seed = [[NSData dataByConcatenatingDatas: [scope dataUsingEncoding:NSUTF8StringEncoding], nameLengthBytes, @@ -377,14 +377,14 @@ counterBytes, nil] hmacWith:PearlHashSHA256 key:key.keyData]; - trc( @"seed is: %@", [seed encodeBase64] ); + trc( @"seed is: %@", [seed encodeHex] ); const char *seedBytes = seed.bytes; // Determine the cipher from the first seed byte. NSAssert( [seed length], @"Missing seed." ); NSArray *typeCiphers = [self ciphersForType:type]; NSString *cipher = typeCiphers[htons( seedBytes[0] ) % [typeCiphers count]]; - trc( @"type %@, ciphers: %@, selected: %@", [self nameOfType:type], typeCiphers, cipher ); + trc( @"type %@ (%lu), ciphers: %@, selected: %@", [self nameOfType:type], (unsigned long)type, typeCiphers, cipher ); // Encode the content, character by character, using subsequent seed bytes and the cipher. NSAssert( [seed length] >= [cipher length] + 1, @"Insufficient seed bytes to encode cipher." ); diff --git a/MasterPassword/ObjC/MPAlgorithmV1.m b/MasterPassword/ObjC/MPAlgorithmV1.m index 2ae95c74..f72d8da8 100644 --- a/MasterPassword/ObjC/MPAlgorithmV1.m +++ b/MasterPassword/ObjC/MPAlgorithmV1.m @@ -69,7 +69,7 @@ NSAssert( [seed length], @"Missing seed." ); NSArray *typeCiphers = [self ciphersForType:type]; NSString *cipher = typeCiphers[seedBytes[0] % [typeCiphers count]]; - trc( @"type %@ (%d), ciphers: %@, selected: %@", [self nameOfType:type], type, typeCiphers, cipher ); + trc( @"type %@ (%lu), ciphers: %@, selected: %@", [self nameOfType:type], (unsigned long)type, typeCiphers, cipher ); // Encode the content, character by character, using subsequent seed bytes and the cipher. NSAssert( [seed length] >= [cipher length] + 1, @"Insufficient seed bytes to encode cipher." );