(byte[] bytes)
| 321 | // Utility function to return the CRC header of an encoded string. This is |
| 322 | // used to verify good decryption and put in front of a new encrypted string |
| 323 | private String crcHeader(byte[] bytes) { |
| 324 | CRC32 crc = new CRC32(); |
| 325 | crc.update(bytes); |
| 326 | int realCRC = (int)crc.getValue(); |
| 327 | |
| 328 | // The first 4 chars of the hex string will equal the first |
| 329 | // 4 chars of the decyphered text. If they match we have a |
| 330 | // good password. This is what we return |
| 331 | realCRC = realCRC ^ (-1); |
| 332 | realCRC = realCRC >>> 0; |
| 333 | String hexCRC = Integer.toHexString(realCRC).substring(0,4); |
| 334 | return hexCRC.toString().toUpperCase(); |
| 335 | |
| 336 | } |
| 337 | |
| 338 | } |
no test coverage detected