Returns md5 hash of a string.
        
        @param password (string) - String to be hashed.
        
        @return (string) - Md5 hash of password.
772087
def MD5Hash(password):
    
    md5_password = md5.new(password)
    password_md5 = md5_password.hexdigest()
    return password_md5
722043
private static byte[] hash(String password, String salt) {

        Key key = Keys.generateSecretKey(password, salt);
        return key.getEncoded();
    }
96266
public static byte[] convert(char[] password, ToBytesMode mode)
    {
        byte[] passwd;

        switch (mode) {
            case PKCS12:
                passwd = PBEParametersGenerator.PKCS12PasswordToBytes(password);
                break;
            case PKCS5:
                passwd = PBEParametersGenerator.PKCS5PasswordToBytes(password);
                break;
            default:
                passwd = PBEParametersGenerator.PKCS5PasswordToUTF8Bytes(password);
                break;
        }

        return passwd;
    }
33789
public static String MD5EncodeToNum(String str) {
		String reStr = null;
		try {
			reStr = new String(str);
			MessageDigest md = MessageDigest.getInstance("MD5");
			reStr = byteArrayToNumString(md.digest(reStr.getBytes()));
		} catch (Exception e) {
		}
		return reStr;
	}
1063298
def generate_nt_hash(password):
    '''
    
    '''
    return binascii.hexlify(
        hashlib.new(
            'md4',
            password.encode('utf-16le')
        ).digest()
    ).upper()
768876
private static String md5(byte[] buffer) {
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            md.update(buffer);
            byte[] digest = md.digest();
            return new String(FlexBase64.encodeBytes(digest, 0, digest.length, false), StandardCharsets.US_ASCII);
        } catch (NoSuchAlgorithmException e) {
            // Should never happen
            throw new InternalError("MD5 not supported on this platform");
        }
    }
1042887
def hash_password(password, salt):
    
    password = str(password).encode('utf-8')
    salt = str(salt).encode('utf-8')
    return hashlib.sha512(password + salt).hexdigest()
310409
private static String credentialMD5digest(String password) {
    try {
      byte[] digest;
      synchronized (__md5Lock) {
        if (__md == null) {
          try {
            __md = MessageDigest.getInstance("MD5");
          } catch (Exception e) {
            throw new IllegalStateException(e);
          }
        }

        __md.reset();
        __md.update(password.getBytes(StandardCharsets.ISO_8859_1));
        digest = __md.digest();
      }

      return __TYPE + toString(digest, 16);
    } catch (Exception e) {
      throw new IllegalStateException(e);
    }
  }
1203716
public static String createPassword(String password) {

        String data = DigestUtils.shaHex(password);
        return data;
    }
234559
public static String toMD5hash(final String s) {

        String hash = null;
        if (null != s) {
            try {
                final MessageDigest digest = MessageDigest.getInstance("MD5");
                digest.update(s.getBytes(Charset.forName("utf-8")));
                final byte[] md5sum = digest.digest();
                final BigInteger bigInt = new BigInteger(1, md5sum);
                hash = bigInt.toString(16);
            } catch (final NoSuchAlgorithmException e) {
                throw new RuntimeException("MD5 digest algorithm implementation not found", e);
            }
        }
        return hash;
    }
631539
public static String getMD5(String md5Salt) {
		try {
			MessageDigest md = MessageDigest.getInstance(MD5);
			byte[] array = md.digest(md5Salt.getBytes(UTF8));
			StringBuffer sb = new StringBuffer();
			for (int i = 0; i < array.length; ++i) {
				sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100).substring(1, 3));
			}
			return sb.toString();
		} catch (java.security.NoSuchAlgorithmException e) {
			LOG.error(e.getMessage());
		} catch (UnsupportedEncodingException e) {
			LOG.error(e.getMessage());
		}
		return null;
	}
684039
static String hashMD5(String s) throws ApiDataException {
        MessageDigest algorithm = null;
        try {
            algorithm = MessageDigest.getInstance("MD5");
        } catch (NoSuchAlgorithmException nsae) {
            throw new ApiDataException("Cannot find MD5 digest algorithm");
        }
        byte[] defaultBytes = new byte[s.length()];
        for (int i = 0; i < s.length(); i++) {
            defaultBytes[i] = (byte) (0xFF & s.charAt(i));
        }
        algorithm.reset();
        algorithm.update(defaultBytes);
        byte messageDigest[] = algorithm.digest();
        StringBuilder hexString = new StringBuilder();
        for (int i = 0; i < messageDigest.length; i++) {
            String hex = Integer.toHexString(0xFF & messageDigest[i]);
            if (hex.length() == 1) {
                hexString.append('0');
            }
            hexString.append(hex);
        }
        return hexString.toString();
    }
1072343
def md5(text):
    """"""

    h = hashlib.md5()
    h.update(_unicode(text).encode("utf-8"))

    return h.hexdigest()
1063285
def md5sum( string ):
    
    h = hashlib.new( 'md5' )
    h.update( string.encode( 'utf-8' ) )
    return h.hexdigest()
1087985
def encode(password)
      primary = ::Digest::MD5.new
      primary << password
      primary << prefix
      primary << @salt

      md5_t = ::Digest::MD5.digest("#{password}#{@salt}#{password}")

      l = password.length
      while l > 0 do
        slice_size = ( l > DIGEST_LENGTH ) ? DIGEST_LENGTH : l
        primary << md5_t[0, slice_size]
        l -= DIGEST_LENGTH
      end

      # weirdness
      l = password.length
      while l != 0
        case (l & 1)
        when 1
          primary << 0.chr
        when 0
          primary << password[0,1]
        end
        l >>= 1
      end

      pd = primary.digest

      encoded_password = "#{prefix}#{@salt}$"

      # apr_md5_encode has this comment about a 60Mhz Pentium above this loop.
      1000.times do |x|
        ctx = ::Digest::MD5.new
        ctx << (( ( x & 1 ) == 1 ) ? password : pd[0,DIGEST_LENGTH])
        (ctx << @salt) unless ( x % 3 ) == 0
        (ctx << password) unless ( x % 7 ) == 0
        ctx << (( ( x & 1 ) == 0 ) ? password : pd[0,DIGEST_LENGTH])
        pd = ctx.digest
      end


      pd = pd.bytes.to_a

      l = (pd[ 0]<<16) | (pd[ 6]<<8) | pd[12]
      encoded_password << to_64(l, 4)

      l = (pd[ 1]<<16) | (pd[ 7]<<8) | pd[13]
      encoded_password << to_64(l, 4)

      l = (pd[ 2]<<16) | (pd[ 8]<<8) | pd[14]
      encoded_password << to_64(l, 4)

      l = (pd[ 3]<<16) | (pd[ 9]<<8) | pd[15]
      encoded_password << to_64(l, 4)

      l = (pd[ 4]<<16) | (pd[10]<<8) | pd[ 5]
      encoded_password << to_64(l, 4)
      encoded_password << to_64(pd[11],2)

      return encoded_password
    end
871360
public static String computePasswordHash(final String password, final String salt) {
    return computePasswordHash(password, stringToSalt(salt));
  }
1289806
public static Password createPassword(char[] password) {
		byte[] salt = JKSecurityUtil.salt();
		byte[] hash = JKSecurityUtil.hash(password, salt);

		Password pass = new Password();
		pass.setHash(encodeInToBase64(hash));
		pass.setSalt(encodeInToBase64(salt));
		return pass;
	}