aiken/crypto
Types
Alias
DataHash = Hash<Blake2b_256, Data>A Hash is nothing more than a ByteArray, but it carries extra
information for readability.
On-chain, any hash digest value is represented as a plain ‘ByteArray’. Though in practice, hashes come from different sources and have different semantics.
Hence, while this type-alias doesn’t provide any strong type-guarantees, it helps writing functions signatures with more meaningful types than mere ‘ByteArray’.
Compare for example:
pub type Credential {
  VerificationKey(ByteArray)
  Script(ByteArray)
}
with
pub type Credential {
  VerificationKey(Hash<Blake2b_224, VerificationKey>)
  Script(Hash<Blake2b_224, Script>)
}
Both are strictly equivalent, but the second reads much better.
Alias
Hash<alg, a> = ByteArrayA Keccak-256 hash algorithm.
Alias
Script = ByteArrayAlias
ScriptHash = Hash<Blake2b_224, Script>A SHA2-256 hash algorithm.
A SHA3-256 hash algorithm.
Alias
Signature = ByteArrayAlias
VerificationKey = ByteArrayAlias
VerificationKeyHash = Hash<Blake2b_224, VerificationKey>Functions
Hashing
      
  
  
  
      
        
        Compute the blake2b-224 hash digest (28 bytes) of some data.
Minimum Plutus Version: 3
      
    
  
  
      
        
        Compute the blake2b-256 hash digest (32 bytes) of some data.
      
    
  
  
      
        
        Compute the keccak-256 hash digest (32 bytes) of some data.
      
    
  
  
      
        
        Compute the sha2-256 hash digest (32 bytes) of some data.
      
    
  
  
      
        
        Compute the sha3-256 hash digest (32 bytes) of some data.
      
    
  
  
      
        Verifying signatures
      
  
  
  
      
        
        Verify an ECDCA signature (over secp256k1) using the given verification key.
Returns True when the signature is valid.
      
    
  
  
      
        
        Verify an Ed25519 signature using the given verification key.
Returns True when the signature is valid.
      
    
  
  
      
    
  
Compute the blake2b-224 hash digest (28 bytes) of some data. Minimum Plutus Version: 3
Compute the blake2b-256 hash digest (32 bytes) of some data.
Compute the keccak-256 hash digest (32 bytes) of some data.
Compute the sha2-256 hash digest (32 bytes) of some data.
Compute the sha3-256 hash digest (32 bytes) of some data.
Verify an ECDCA signature (over secp256k1) using the given verification key.
Returns True when the signature is valid.
Verify an Ed25519 signature using the given verification key.
Returns True when the signature is valid.