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

org.elasticmq.DeduplicationId.scala Maven / Gradle / Ivy

The newest version!
package org.elasticmq

import java.security.MessageDigest

case class DeduplicationId(id: String) extends AnyVal

object DeduplicationId {
  def fromMessageBody(body: String): DeduplicationId = DeduplicationId(sha256Hash(body))

  private def sha256Hash(text: String): String = {
    String.format(
      "%064x",
      new java.math.BigInteger(1, MessageDigest.getInstance("SHA-256").digest(text.getBytes("UTF-8")))
    )
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy