次のコード (CC_SHA256) を使用して NSString 入力をエンコードしています。同じロジックを使用して、デコードされた形式で取得するのを手伝ってくれる人はいますか?
-(NSString*) encodeAndGetHashInfo :(NSString *) inStringToHashIt
{
NSDate *currentDate = [NSDate date];
NSLog(@"currentDate %@",currentDate);
NSTimeInterval currTimeMillsecs = ([currentDate timeIntervalSince1970] * 1000);
NSString *strCurrTimeMilliSecs = [NSString stringWithFormat:@"%.0f", currTimeMillsecs];
NSLog(@"strCurrTimeMilliSecs: %@", strCurrTimeMilliSecs); //here we are getting millsec in this way 1328962624994.734131
//double currentTime=[strCurrTimeMilliSecs doubleValue];
//Do hashing
NSString *withSalt= [NSString stringWithFormat:@"%@%@%@", strCurrTimeMilliSecs, inStringToHashIt,STATIC_HASH];
NSLog(@"withSalt.%@",withSalt);
NSString *inputStr = withSalt;
unsigned char hashedChars[32];
CC_SHA256([inputStr UTF8String],
[inputStr lengthOfBytesUsingEncoding:NSUTF8StringEncoding],
hashedChars);
NSData * hashedData = [NSData dataWithBytes:hashedChars length:32];
NSLog (@"hashedData:%@",hashedData );
NSString* hashPasswordResponse = NULL;
hashPasswordResponse = [NSString stringWithFormat:@"%@", hashedData];
hashPasswordResponse = [hashPasswordResponse stringByReplacingOccurrencesOfString:@" " withString:@""];
NSLog(@"hashPasswordResponse.......%@",hashPasswordResponse);//this string is
return hashPasswordResponse;
}