@@ -21,12 +21,11 @@ */ #import "LegacyPasswordGenerator.h" @implementation LegacyPasswordGenerator -@synthesize length = _length, site = _site, passphrase = _passphrase; -@synthesize output = _output; +@synthesize site = _site, passphrase = _passphrase, output = _output; + (instancetype)generator { return [[[self alloc] init] autorelease]; } @@ -37,10 +36,23 @@ _length = 16; return self; } + +- (void)setLength: (size_t)length +{ + if (length < 3) + @throw [OFInvalidArgumentException exception]; + + _length = length; +} + +- (size_t)length +{ + return _length; +} - (void)derivePassword { OFSHA256Hash *siteHash = [OFSHA256Hash cryptoHash]; [siteHash updateWithBuffer: [_site UTF8String]