Returns the byte array for the given salt id WARNING: Don't use this one unless you know what you're doing. It's here for unit testing. @param bucket The ID of the bucket to get the salt for @return The salt as a byte array based on the width in bytes @since 2.2
(final int bucket)
| 113 | * @since 2.2 |
| 114 | */ |
| 115 | public static byte[] getSaltBytes(final int bucket) { |
| 116 | final byte[] bytes = new byte[Const.SALT_WIDTH()]; |
| 117 | int shift = 0; |
| 118 | for (int i = 1;i <= Const.SALT_WIDTH(); i++) { |
| 119 | bytes[Const.SALT_WIDTH() - i] = (byte) (bucket >>> shift); |
| 120 | shift += 8; |
| 121 | } |
| 122 | return bytes; |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * Calculates and writes an array of one or more salt bytes at the front of |