(int length)
| 2419 | } |
| 2420 | |
| 2421 | public String randomBytes(int length) { |
| 2422 | |
| 2423 | if (length <= 0) { |
| 2424 | throw new IllegalArgumentException("length must be greater than 0"); |
| 2425 | } |
| 2426 | |
| 2427 | byte[] x = new byte[length]; |
| 2428 | secureRandom.nextBytes(x); |
| 2429 | |
| 2430 | return bytesToHex(x); |
| 2431 | } |
| 2432 | |
| 2433 | private String bytesToHex(byte[] bytes) { |
| 2434 | StringBuilder sb = new StringBuilder(bytes.length * 2); |
no test coverage detected