package cd.casic.framework.commons.util.encrypt;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Arrays;

/**
 * @author liubin
 * @date 2023/10/10 14:00
 * @description
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class DHKeyPair {

    private byte[] publicKey;

    private byte[] privateKey;

    @Override
    public boolean equals(Object other) {
        if (this == other) return true;
        assert other != null;
        if (this.getClass() != other.getClass()) return false;

        if (!Arrays.equals(publicKey,((DHKeyPair) other).publicKey)) return false;
        if (!Arrays.equals(privateKey, ((DHKeyPair) other).privateKey)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = Arrays.hashCode(publicKey);
        result = 31 * result + Arrays.hashCode(privateKey);
        return result;
    }
}
