Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** Generates a 128 bits cryptographically secure key, formatted as a UUID.
- * Keep that you won't have the same guarantee for uniqueness
- * as you have with regular UUIDs.
- * @return A cryptographically secure UUID.
- */
- + (NSString*)generateCryptoSecureUUID
- {
- unsigned char bytes[16];
- int result = SecRandomCopyBytes(kSecRandomDefault, 16, bytes);
- if (result != noErr) {
- return nil;
- }
- return [[NSUUID alloc] initWithUUIDBytes:bytes].UUIDString;
- }
Add Comment
Please, Sign In to add comment