File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
src/main/java/de/rub/nds/modifiablevariable/util Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * TLS-Attacker - A Modular Penetration Testing Framework for TLS
3+ *
4+ * Copyright 2014-2016 Ruhr University Bochum / Hackmanit GmbH
5+ *
6+ * Licensed under Apache License 2.0
7+ * http://www.apache.org/licenses/LICENSE-2.0
8+ */
9+ package de .rub .nds .modifiablevariable .util ;
10+
11+ import java .util .Random ;
12+
13+ /**
14+ * A fake random number generator for testing.
15+ * This generator will always return the byte "retVal" passed to the constructor.
16+ *
17+ */
18+ public class BadFixedRandom extends Random {
19+
20+ byte retVal ;
21+
22+ public BadFixedRandom (byte retVal ) {
23+ this .retVal = retVal ;
24+ }
25+
26+ /**
27+ * Fills a user-supplied byte array with the fixed byte given at object initialization.
28+ * The number of "random" bytes produced is equal to the length of the byte array.
29+ */
30+ @ Override
31+ public void nextBytes (byte [] bytes ) {
32+ for (int i = 0 , len = bytes .length ; i < len ;)
33+ bytes [i ++] = retVal ;
34+ }
35+
36+ }
You can’t perform that action at this time.
0 commit comments