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
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/38310/Profile.png)
_jeffreyjackson
160.5K
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/39048/b623a92dd135da923449542204a34e40.jpeg)
dbrajkovic
69.5K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#