NSString SHA1 Verification
Quick and easy to implement NSString SHA1 verification tool to check to see if an NSString is a valid SHA1 has before sending over an unencrypted password to a server
- (BOOL) isSHA1:(NSString *) candidate;
- (BOOL) isSHA1:(NSString *)candidate {
NSString *regex = @"^[a-f0-9]{40}$";
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
return [predicate evaluateWithObject:candidate];
}
Written by Max Kramer
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Objective-c
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#