All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hejinonline.util.Base58Digist.scala Maven / Gradle / Ivy

The newest version!
package com.hejinonline.util

import java.security.MessageDigest

object Base58Digist {
  def md5(str: String = UUID.randomUUID) = digest("MD5", str)
  def sha1(str: String = UUID.randomUUID) = digest("SHA-1", str)
  def sha256(str: String = UUID.randomUUID) = digest("SHA-256", str)

  private def digest(name: String, str: String) = {
    if (str == null) null
    else {
      val messageDigest = MessageDigest.getInstance(name)
      messageDigest.update(str.getBytes)
      Base58.encode(messageDigest.digest)
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy