Created
October 9, 2011 20:42
-
-
Save cruffenach/1274142 to your computer and use it in GitHub Desktop.
An NSString subclass main for use with encrypted strings. For an article at www.iCodeBlog.com
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "MaaSEncryptedString.h" | |
#import "NSString+Helper.h" | |
@implementation MaaSEncryptedString | |
+(NSString*)encryptedString:(NSString*)string { | |
return [[NSString stringWithFormat:@"%@", [string SHA1]]; | |
} | |
+(id)encryptedStringWithString:(NSString *)string { | |
return [[[MaaSEncryptedString alloc] initWithString:string] autorelease]; | |
} | |
-(id)initWithString:(NSString*)string { | |
if(self = [self init]) { | |
_backingStore = [[MaaSEncryptedString encryptedString:string] copy]; | |
} | |
return self; | |
} | |
-(void)dealloc { | |
[_backingStore release]; | |
[super dealloc]; | |
} | |
-(NSUInteger)length { | |
return [_backingStore length]; | |
} | |
-(unichar)characterAtIndex:(NSUInteger)index { | |
return [_backingStore characterAtIndex:index]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment