message: Don't hash message
diff: @@ -6,13 +6,13 @@ use k256::{
  };
  use sha2::Digest; // trait
  -use std::convert::{TryFrom, TryInto};
  +use std::convert::TryFrom;
  use crate::errors::{VmError, VmResult};
  use crate::identity_digest::Identity256;
  pub fn ed25519_verify(
  - message_hash: &[u8],
  + message: &[u8],
  signature_bytes: &[u8],
  public_key_bytes: &[u8],
  ) -> VmResult<()> {
  @@ -21,7 +21,7 @@ pub fn ed25519_verify(
  let signature = res.map_err(|err| VmError::crypto_err(err.to_string()))?;
  ed25519::VerificationKey::try_from(public_key_bytes)
  - .and_then(|vk| vk.verify(&signature, &message_hash))
  + .and_then(|vk| vk.verify(&signature, &message))
  .map_err(|err| VmError::crypto_err(err.to_string()))
  }
  @@ -61,12 +61,10 @@ mod tests {
  #[test]
  fn test_ed25519_verify() {
  - // Explicit hash
  - let message_hash = Sha256::new().chain(MSG).finalize();
  -
  + let message = MSG.as_bytes();
  // Signing
  let secret_key = ed25519::SigningKey::new(&mut OsRng);
  - let signature = secret_key.sign(&message_hash);
  + let signature = secret_key.sign(&message);
  let public_key = ed25519::VerificationKey::from(&secret_key);
  @@ -75,16 +73,16 @@ mod tests {
  let public_key_bytes: [u8; 32] = public_key.into();
  // Verification
  - assert!(ed25519_verify(&message_hash, &signature_bytes, &public_key_bytes).is_ok());
  + assert!(ed25519_verify(&message, &signature_bytes, &public_key_bytes).is_ok());
  // Wrong message fails
  - let bad_message_hash = Sha256::new().chain([MSG, "\0"].concat()).finalize();
  - assert!(ed25519_verify(&bad_message_hash, &signature_bytes, &public_key_bytes).is_err());
  + let bad_message = [message, b"\0"].concat();
  + assert!(ed25519_verify(&bad_message, &signature_bytes, &public_key_bytes).is_err());
  // Other pubkey fails
  let other_secret_key = ed25519::SigningKey::new(&mut OsRng);
  let other_public_key = ed25519::VerificationKey::from(&other_secret_key);
  let other_public_key_bytes: [u8; 32] = other_public_key.into();
  - assert!(ed25519_verify(&message_hash, &signature_bytes, &other_public_key_bytes).is_err());
  + assert!(ed25519_verify(&message, &signature_bytes, &other_public_key_bytes).is_err());
  }
  }
  