jeudi 5 janvier 2017

How to implement random_bytes(16) from PHP in iOS Objective C?

I want to Implement random_bytes(16) in Objective C, In PHP output string is something like this:

d�g���&���$�

I tried this code for Objective C:

uint8_t randomBytes[16];
int result = SecRandomCopyBytes(kSecRandomDefault, 16, randomBytes);
NSString *iv = [NSString stringWithFormat:@"%s",randomBytes];

But this is not like PHP output.
Please help me.




Aucun commentaire:

Enregistrer un commentaire