interconnect/model/src/main/java/de/taimos/dvalin/interconnect/model/MessageCryptoUtil.java
/**
     * @param msg the message to sign
     * @return the signature hash
     * @throws CryptoException on sign error
     */
@param msg the message to sign
@return the signature hash
@throws CryptoException on sign error
@param msg the message to sign @return the signature hash @throws CryptoException on sign error
public static String sign(final String msg) throws CryptoException {
        try {
            final String toEnc = msg + MessageCryptoUtil.SIGNATURE;
            final MessageDigest mdEnc = MessageDigest.getInstance("MD5");
            mdEnc.update(toEnc.getBytes(StandardCharsets.UTF_8), 0, toEnc.length());
            return new BigInteger(1, mdEnc.digest()).toString(16);
        } catch (final Exception e) {
            throw new CryptoException("Creating signature failed", e);
        }
    }
public static String sign ( final String msg ) throws CryptoException { try { final String toEnc = msg + MessageCryptoUtil . SIGNATURE ; final MessageDigest mdEnc = MessageDigest . getInstance ( "MD5" ) ; mdEnc . update ( toEnc . getBytes ( StandardCharsets . UTF_8 ) , 0 , toEnc . length ( ) ) ; return new BigInteger ( 1 , mdEnc . digest ( ) ) . toString ( 16 ) ; } catch ( final Exception e ) { throw new CryptoException ( "Creating signature failed" , e ) ; } }
@param msg the message to sign
 @return the signature hash
 @throws CryptoException on sign error
@param msg the message to sign @return the signature hash @throws CryptoException on sign error