@@ -0,0 +1,2141 @@
+package cologne.eck.peafactory.crypto;%0A%0A/*%0A * Peafactory - Production of Password Encryption Archives%0A * Copyright (C) 2015  Axel von dem Bruch%0A * %0A * This library is free software; you can redistribute it and/or modify it %0A * under the terms of the GNU General Public License as published %0A * by the Free Software Foundation; either version 2 of the License, %0A * or (at your option) any later version.%0A * This library is distributed in the hope that it will be useful, but %0A * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY %0A * or FITNESS FOR A PARTICULAR PURPOSE. %0A * See the GNU General Public License for more details.%0A * See:  http://www.gnu.org/licenses/gpl-2.0.html%0A * You should have received a copy of the GNU General Public License %0A * along with this library.%0A */%0A%0A/**%0A * Handles hash functions. %0A */%0Aimport org.bouncycastle.crypto.Digest;%0A%0Aimport cologne.eck.peafactory.tools.Zeroizer;%0A%0Apublic class HashStuff %7B%0A%09%09%0A%09private static Digest hashAlgo;%0A%09%0A%09/**%0A%09 * Perform a hash function and clear the input immediately%0A%09 * %0A%09 * @param input%09%09the input to hash%0A%09 * @return%09%09%09the output of the hash function%0A%09 */%0A%09public static final byte%5B%5D hashAndOverwrite(byte%5B%5D input) %7B%0A%0A        hashAlgo.update(input, 0, input.length);%0A        %0A        byte%5B%5D digest = new byte%5BhashAlgo.getDigestSize()%5D;%0A%0A        hashAlgo.doFinal(digest, 0);%0A%0A        Zeroizer.zero(input);%0A%0A        return digest;%0A%09%7D%0A%0A%09/**%0A%09 * Perform a hash function%0A%09 * %0A%09 * @param input%09%09the input to hash%0A%09 * @return%09%09%09the output of the hash function%0A%09 */%0A%09public static final byte%5B%5D hash(byte%5B%5D input) %7B%0A%09%09%0A        hashAlgo.update(input, 0, input.length);%0A%0A        byte%5B%5D digest = new byte%5BhashAlgo.getDigestSize()%5D;%0A%0A        hashAlgo.doFinal(digest, 0);%0A%0A        return digest;%0A%09%7D%0A%09%0A%09//=================%0A%09// Getter & Setter:%0A%09/**%0A%09 * Get the used hash function%0A%09 * %0A%09 * @return%09the hash function%0A%09 */%0A%09public static final Digest getHashAlgo() %7B%0A%09%09return hashAlgo;%0A%09%7D%0A%09/**%0A%09 * Set the hash function%0A%09 * %0A%09 * @param _hashAlgo%09the hash function to be used%0A%09 */%0A%09public static final void setHashAlgo(Digest _hashAlgo) %7B%0A%09%09hashAlgo = _hashAlgo;%0A%09%7D%09%0A%7D%0A

Create HashStuff.java