我有两个 NSString,它们是 AES256 加密的。是否可以比较这两个加密字符串?
NSString *passKey = @"mykey";
NSData *data = [@"string to encrypt" dataUsingEncoding:NSUTF8StringEncoding];
NSError *error;
NSData *encryptedData1 = [RNEncryptor encryptData:data
withSettings:kRNCryptorAES256Settings
password:passKey
error:&error];
NSData *encryptedData2 = [RNEncryptor encryptData:data
withSettings:kRNCryptorAES256Settings
password:passKey
error:&error];
NSString *aesEncryptedString1 = [[NSString alloc] initWithData:encryptedData1 encoding:NSASCIIStringEncoding];
NSString *aesEencryptedString2 = [[NSString alloc] initWithData:encryptedData2 encoding:NSASCIIStringEncoding];
NSLog(@"aesEencryptedString1 is %@",encryptedstring1);
NSLog(@"aesEencryptedString2 is %@",encryptedstring2);
if ([aesEncryptedString1 isEqualToString:aesEencryptedString2])
{
NSLog(@"Success");
}