comparison dcrypt/crypto/prngs/PBKDF2.d @ 32:2b4bccdc8387

Added version() statements to play nice with D2's current feelings about const. Changed a few methods (addEntropy and read in the base PRNG class, and the constructor for ParametersWithIV) to accept void[] in place of ubyte[].
author Thomas Dixon <reikon@reikon.us>
date Tue, 12 May 2009 22:09:33 -0400
parents 21847420b1ac
children b9f8aa42a547
comparison
equal deleted inserted replaced
31:f429c5e9dd69 32:2b4bccdc8387
67 index = this.prf.macSize; 67 index = this.prf.macSize;
68 68
69 _initialized = true; 69 _initialized = true;
70 } 70 }
71 71
72 void addEntropy(ubyte[] input) 72 void addEntropy(void[] input)
73 { 73 {
74 throw new NotSupportedError(name()~": Not supported."); 74 throw new NotSupportedError(name()~": addEntropy is not supported.");
75 } 75 }
76 76
77 /** 77 /**
78 * Throws: LimitReachedError after 2^32 blocks. 78 * Throws: LimitReachedError after 2^32 blocks.
79 */ 79 */
80 uint read(ubyte[] output) 80 uint read(void[] output_)
81 { 81 {
82 ubyte[] output = cast(ubyte[])output_;
83
82 for (uint i = 0; i < output.length; i++) 84 for (uint i = 0; i < output.length; i++)
83 { 85 {
84 if (index == buffer.length) 86 if (index == buffer.length)
85 { 87 {
86 if (++blockCount == 0) // Catch rollover 88 if (++blockCount == 0) // Catch rollover