Skip to content

Commit

Permalink
crypto: fixed domain was handled is big endian
Browse files Browse the repository at this point in the history
  • Loading branch information
zilm13 committed Aug 20, 2019
1 parent 2b4826c commit 2bcf5c2
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package org.ethereum.beacon.crypto;

import tech.pegasys.artemis.ethereum.core.Hash32;
import tech.pegasys.artemis.util.bytes.Bytes32;
import tech.pegasys.artemis.util.bytes.Bytes8;
import tech.pegasys.artemis.util.bytes.BytesValue;
import tech.pegasys.artemis.util.uint.UInt64;

/**
Expand All @@ -17,6 +15,14 @@
*/
public interface MessageParameters {

static MessageParameters create(Hash32 hash, Bytes8 domain) {
return new Impl(hash, domain);
}

static MessageParameters create(Hash32 hash, UInt64 domain) {
return new Impl(hash, domain.toBytes8LittleEndian());
}

/**
* Returns a hash of the message.
*
Expand All @@ -31,14 +37,6 @@ public interface MessageParameters {
*/
Bytes8 getDomain();

static MessageParameters create(Hash32 hash, Bytes8 domain) {
return new Impl(hash, domain);
}

static MessageParameters create(Hash32 hash, UInt64 domain) {
return new Impl(hash, domain.toBytesBigEndian());
}

/** A straightforward implementation of {@link MessageParameters}. */
class Impl implements MessageParameters {
private final Hash32 hash;
Expand Down

0 comments on commit 2bcf5c2

Please sign in to comment.