From: <gel...@mx...> - 2003-02-07 15:03:30
|
gelderen 03/02/07 10:11:36 Added: jce/src/cryptix.jce.test InsecureRandom.java Log: Add partially function fixed-sequence implementation of SecureRandom. This is useful to make randomized algorithms behave deterministically. Revision Changes Path 1.1 projects/jce/src/cryptix.jce.test/InsecureRandom.java Index: InsecureRandom.java =================================================================== package cryptix.jce.test; import java.security.SecureRandom; /*package*/ final class InsecureRandom extends SecureRandom { private final byte[] _stream; private int _streamOff; public InsecureRandom(byte[] stream) { _stream = stream; _streamOff = 0; } public void nextBytes(byte[] buf) { if(buf.length > (_stream.length - _streamOff)) throw new Error("Out of fixed bytes!"); System.arraycopy(_stream, _streamOff, buf, 0, buf.length); System.out.println("nextBytes yields: " + Util.toString(buf)); } } |