Object writeReplace() { return UnixDESCryptPassword.createRaw(getAlgorithm(), salt, hash); }
private static Password createCryptBasedPassword(byte[] userPassword) throws InvalidKeySpecException { if (userPassword.length != 20) { throw log.insufficientDataToFormDigestAndSalt(); } final int lo = ModularCrypt.MOD_CRYPT.decode(userPassword[7] & 0xff); final int hi = ModularCrypt.MOD_CRYPT.decode(userPassword[8] & 0xff); if (lo == -1 || hi == -1) { throw log.invalidSalt((char) lo, (char) hi); } short salt = (short) (lo | hi << 6); byte[] hash = CodePointIterator.ofUtf8Bytes(userPassword, 9, 11).base64Decode(ModularCrypt.MOD_CRYPT, false).drain(); return UnixDESCryptPassword.createRaw(ALGORITHM_CRYPT_DES, salt, hash); }
private static Password parseUnixDESCryptPasswordString(char[] cryptString) throws InvalidKeySpecException { assert cryptString.length == 13; // previously tested by doIdentifyAlgorithm CodePointIterator r = CodePointIterator.ofChars(cryptString); // 12 bit salt int s0 = MOD_CRYPT.decode(r.next()); int s1 = MOD_CRYPT.decode(r.next()); short salt = (short) (s0 | s1 << 6); // 64 bit hash byte[] hash = r.base64Decode(MOD_CRYPT, false).limitedTo(8).drain(); return UnixDESCryptPassword.createRaw(UnixDESCryptPassword.ALGORITHM_CRYPT_DES, salt, hash); }
Object writeReplace() { return UnixDESCryptPassword.createRaw(getAlgorithm(), salt, hash); }
Object writeReplace() { return UnixDESCryptPassword.createRaw(getAlgorithm(), salt, hash); }
Object writeReplace() { return UnixDESCryptPassword.createRaw(getAlgorithm(), salt, hash); }
private static Password createCryptBasedPassword(byte[] userPassword) throws InvalidKeySpecException { if (userPassword.length != 20) { throw log.insufficientDataToFormDigestAndSalt(); } final int lo = ModularCrypt.MOD_CRYPT.decode(userPassword[7] & 0xff); final int hi = ModularCrypt.MOD_CRYPT.decode(userPassword[8] & 0xff); if (lo == -1 || hi == -1) { throw log.invalidSalt((char) lo, (char) hi); } short salt = (short) (lo | hi << 6); byte[] hash = CodePointIterator.ofUtf8Bytes(userPassword, 9, 11).base64Decode(ModularCrypt.MOD_CRYPT, false).drain(); return UnixDESCryptPassword.createRaw(ALGORITHM_CRYPT_DES, salt, hash); }
private static Password createCryptBasedPassword(byte[] userPassword) throws InvalidKeySpecException { if (userPassword.length != 20) { throw log.insufficientDataToFormDigestAndSalt(); } final int lo = ModularCrypt.MOD_CRYPT.decode(userPassword[7] & 0xff); final int hi = ModularCrypt.MOD_CRYPT.decode(userPassword[8] & 0xff); if (lo == -1 || hi == -1) { throw log.invalidSalt((char) lo, (char) hi); } short salt = (short) (lo | hi << 6); byte[] hash = CodePointIterator.ofUtf8Bytes(userPassword, 9, 11).base64Decode(ModularCrypt.MOD_CRYPT, false).drain(); return UnixDESCryptPassword.createRaw(ALGORITHM_CRYPT_DES, salt, hash); }
private static Password createCryptBasedPassword(byte[] userPassword) throws InvalidKeySpecException { if (userPassword.length != 20) { throw log.insufficientDataToFormDigestAndSalt(); } final int lo = ModularCrypt.MOD_CRYPT.decode(userPassword[7] & 0xff); final int hi = ModularCrypt.MOD_CRYPT.decode(userPassword[8] & 0xff); if (lo == -1 || hi == -1) { throw log.invalidSalt((char) lo, (char) hi); } short salt = (short) (lo | hi << 6); byte[] hash = CodePointIterator.ofUtf8Bytes(userPassword, 9, 11).base64Decode(ModularCrypt.MOD_CRYPT, false).drain(); return UnixDESCryptPassword.createRaw(ALGORITHM_CRYPT_DES, salt, hash); }
private static Password parseUnixDESCryptPasswordString(char[] cryptString) throws InvalidKeySpecException { assert cryptString.length == 13; // previously tested by doIdentifyAlgorithm CodePointIterator r = CodePointIterator.ofChars(cryptString); // 12 bit salt int s0 = MOD_CRYPT.decode(r.next()); int s1 = MOD_CRYPT.decode(r.next()); short salt = (short) (s0 | s1 << 6); // 64 bit hash byte[] hash = r.base64Decode(MOD_CRYPT, false).limitedTo(8).drain(); return UnixDESCryptPassword.createRaw(UnixDESCryptPassword.ALGORITHM_CRYPT_DES, salt, hash); }
private static Password parseUnixDESCryptPasswordString(char[] cryptString) throws InvalidKeySpecException { assert cryptString.length == 13; // previously tested by doIdentifyAlgorithm CodePointIterator r = CodePointIterator.ofChars(cryptString); // 12 bit salt int s0 = MOD_CRYPT.decode(r.next()); int s1 = MOD_CRYPT.decode(r.next()); short salt = (short) (s0 | s1 << 6); // 64 bit hash byte[] hash = r.base64Decode(MOD_CRYPT, false).limitedTo(8).drain(); return UnixDESCryptPassword.createRaw(UnixDESCryptPassword.ALGORITHM_CRYPT_DES, salt, hash); }
private static Password parseUnixDESCryptPasswordString(char[] cryptString) throws InvalidKeySpecException { assert cryptString.length == 13; // previously tested by doIdentifyAlgorithm CodePointIterator r = CodePointIterator.ofChars(cryptString); // 12 bit salt int s0 = MOD_CRYPT.decode(r.next()); int s1 = MOD_CRYPT.decode(r.next()); short salt = (short) (s0 | s1 << 6); // 64 bit hash byte[] hash = r.base64Decode(MOD_CRYPT, false).limitedTo(8).drain(); return UnixDESCryptPassword.createRaw(UnixDESCryptPassword.ALGORITHM_CRYPT_DES, salt, hash); }