我想在iOS中加密密碼。在iOS中加密和解密密碼
NSData *dataIn = [@"Now is the time for all good computers to come to the aid of their masters." dataUsingEncoding:NSASCIIStringEncoding];
NSMutableData *macOut = [NSMutableData dataWithLength:CC_SHA256_DIGEST_LENGTH];
CC_SHA256(dataIn.bytes, dataIn.length, macOut.mutableBytes);
NSLog(@"dataIn: %@", dataIn);
NSLog(@"macOut: %@", macOut);
我想用指定的鍵創建。有沒有辦法做到這一點。
謝謝。
不要使用SHA256。 Bcrypt或PBKDF2。 SHA256太弱。用散列加密數據,不要存儲它進行比較,總是從用戶輸入中生成。 –