symbolic-base-0.1.0.0: ZkFold Symbolic compiler and zero-knowledge proof protocols
Safe HaskellSafe-Inferred
LanguageHaskell2010

ZkFold.Symbolic.Data.Hash

Synopsis

Documentation

class Hashable h a where Source #

A generic hashing interface for Symbolic DSL. h is the result of the hashing algorithm; a is the datatype being hashed.

The relationship between datatypes and hashes is many-to-many so there's no functional dependency in either direction.

Methods

hasher :: a -> h Source #

Hashing algorithm itself.

data Hash h a Source #

An invertible hash h of a symbolic datatype a.

Constructors

Hash 

Fields

Instances

Instances details
Generic (Hash h a) Source # 
Instance details

Defined in ZkFold.Symbolic.Data.Hash

Associated Types

type Rep (Hash h a) :: Type -> Type #

Methods

from :: Hash h a -> Rep (Hash h a) x #

to :: Rep (Hash h a) x -> Hash h a #

(SymbolicOutput h, SymbolicOutput a) => SymbolicData (Hash h a) Source # 
Instance details

Defined in ZkFold.Symbolic.Data.Hash

Associated Types

type Context (Hash h a) :: (Type -> Type) -> Type Source #

type Support (Hash h a) Source #

type Layout (Hash h a) :: Type -> Type Source #

type Payload (Hash h a) :: Type -> Type Source #

Methods

arithmetize :: Hash h a -> Support (Hash h a) -> Context (Hash h a) (Layout (Hash h a)) Source #

payload :: Hash h a -> Support (Hash h a) -> Payload (Hash h a) (WitnessField (Context (Hash h a))) Source #

restore :: Context (Hash h a) ~ c => (Support (Hash h a) -> (c (Layout (Hash h a)), Payload (Hash h a) (WitnessField c))) -> Hash h a Source #

(SymbolicInput h, SymbolicInput a) => SymbolicInput (Hash h a) Source # 
Instance details

Defined in ZkFold.Symbolic.Data.Hash

Methods

isValid :: Hash h a -> Bool (Context (Hash h a)) Source #

type Rep (Hash h a) Source # 
Instance details

Defined in ZkFold.Symbolic.Data.Hash

type Rep (Hash h a) = D1 ('MetaData "Hash" "ZkFold.Symbolic.Data.Hash" "symbolic-base-0.1.0.0-inplace" 'False) (C1 ('MetaCons "Hash" 'PrefixI 'True) (S1 ('MetaSel ('Just "hHash") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 h) :*: S1 ('MetaSel ('Just "hValue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Payloaded (Layout a :*: Payload a) (Context h)))))
type Context (Hash h a) Source # 
Instance details

Defined in ZkFold.Symbolic.Data.Hash

type Context (Hash h a) = GContext (Rep (Hash h a))
type Layout (Hash h a) Source # 
Instance details

Defined in ZkFold.Symbolic.Data.Hash

type Layout (Hash h a) = GLayout (Rep (Hash h a))
type Payload (Hash h a) Source # 
Instance details

Defined in ZkFold.Symbolic.Data.Hash

type Payload (Hash h a) = GPayload (Rep (Hash h a))
type Support (Hash h a) Source # 
Instance details

Defined in ZkFold.Symbolic.Data.Hash

type Support (Hash h a) = GSupport (Rep (Hash h a))

hash :: (Hashable h a, SymbolicOutput a, Context h ~ Context a) => a -> Hash h a Source #

Restorably hash the data.

preimage :: forall h a c. (Hashable h a, SymbolicOutput a, Context h ~ c, Context a ~ c, Eq (Bool c) h) => Hash h a -> a Source #

Restore the data which were hashed.