1 package io.bytom.types;
\r
3 import org.bouncycastle.util.encoders.Hex;
\r
5 import java.util.Objects;
\r
9 private String hexValue;
\r
14 public Hash(String hexValue) {
\r
15 this.hexValue = hexValue;
\r
18 public Hash(byte[] byteArray) {
\r
19 this.hexValue = Hex.toHexString(byteArray);
\r
22 public byte[] toByteArray() {
\r
23 return Hex.decode(this.hexValue);
\r
27 public boolean equals(Object o) {
\r
28 if (this == o) return true;
\r
29 if (o == null || getClass() != o.getClass()) return false;
\r
30 Hash hash = (Hash) o;
\r
31 return Objects.equals(hexValue, hash.hexValue);
\r
35 public int hashCode() {
\r
36 return Objects.hash(hexValue);
\r
40 public String toString() {
\r
41 return this.hexValue;
\r