All Projects → adjoint-io → Auth Adt

adjoint-io / Auth Adt

Licence: bsd-3-clause
Authenticated Data Structures Generically

Programming Languages

haskell
3896 projects

Projects that are alternatives of or similar to Auth Adt

Firo
The privacy-focused cryptocurrency
Stars: ✭ 528 (+252%)
Mutual labels:  merkle-tree, cryptography, privacy
Webcrypto
W3C Web Cryptography API for Node.js
Stars: ✭ 79 (-47.33%)
Mutual labels:  hashing, cryptography
Veracruz
Main repository for the Veracruz privacy-preserving compute project.
Stars: ✭ 71 (-52.67%)
Mutual labels:  cryptography, privacy
Dontclickshit
Як не стати кібер-жертвою
Stars: ✭ 149 (-0.67%)
Mutual labels:  cryptography, privacy
Cloakify
CloakifyFactory - Data Exfiltration & Infiltration In Plain Sight; Convert any filetype into list of everyday strings, using Text-Based Steganography; Evade DLP/MLS Devices, Defeat Data Whitelisting Controls, Social Engineering of Analysts, Evade AV Detection
Stars: ✭ 1,136 (+657.33%)
Mutual labels:  cryptography, privacy
Lazysodium Android
An Android implementation of the Libsodium cryptography library. For the lazy dev.
Stars: ✭ 69 (-54%)
Mutual labels:  hashing, cryptography
Mpyc
MPyC for Secure Multiparty Computation in Python
Stars: ✭ 142 (-5.33%)
Mutual labels:  cryptography, privacy
Pathwar
☠️ The Pathwar Project ☠️
Stars: ✭ 58 (-61.33%)
Mutual labels:  cryptography, privacy
Library
Collection of papers in the field of distributed systems, game theory, cryptography, cryptoeconomics, zero knowledge
Stars: ✭ 100 (-33.33%)
Mutual labels:  cryptography, privacy
Easycrypt
Android cryptography library with SecureRandom patches.
Stars: ✭ 102 (-32%)
Mutual labels:  hashing, cryptography
Coniks Go
A CONIKS implementation in Golang
Stars: ✭ 102 (-32%)
Mutual labels:  merkle-tree, cryptography
Low Latency Android Ios Linux Windows Tvos Macos Interactive Audio Platform
🇸Superpowered Audio, Networking and Cryptographics SDKs. High performance and cross platform on Android, iOS, macOS, tvOS, Linux, Windows and modern web browsers.
Stars: ✭ 1,121 (+647.33%)
Mutual labels:  hashing, cryptography
Exonum Client
JavaScript client for Exonum blockchain
Stars: ✭ 62 (-58.67%)
Mutual labels:  merkle-tree, cryptography
Ssri
Standard Subresource Integrity library for Node.js
Stars: ✭ 69 (-54%)
Mutual labels:  hashing, cryptography
Coniks Java
A CONIKS implementation in Java
Stars: ✭ 58 (-61.33%)
Mutual labels:  merkle-tree, cryptography
I2pdbrowser
i2pd browser bundle
Stars: ✭ 94 (-37.33%)
Mutual labels:  cryptography, privacy
Password4j
Password4j is a user-friendly cryptographic library that supports Argon2, Bcrypt, Scrypt, PBKDF2 and various cryptographic hash functions.
Stars: ✭ 124 (-17.33%)
Mutual labels:  hashing, cryptography
Esecurity
MSc Module
Stars: ✭ 49 (-67.33%)
Mutual labels:  hashing, cryptography
Merkle Tools
Tools for creating Merkle trees, generating merkle proofs, and verification of merkle proofs.
Stars: ✭ 54 (-64%)
Mutual labels:  merkle-tree, cryptography
0fc
Anonymous web chat server, built on top of Themis/WebThemis
Stars: ✭ 98 (-34.67%)
Mutual labels:  cryptography, privacy

CircleCI

Derive inclusion and membership proofs for arbitrary sum-of-product datatypes in Haskell using GHC.Generics.

Authenticated Data Structures, Generically

Authenticated data structures (ADS) allow untrusted parties (provers) answer queries on a data structures on behalf of a trusted source (verifier) and provide a compact proof of the computation. A verifier can then efficiently check the authenticity of the answer.

In their paper "Authenticated Data Structures, Generically"[1], A. Miller et al. present a generic method to program authenticated operations over any data structure. They define a well-typed functional programming language, called lambda-auth, whose programs result in code that is secure under the standard cryptographic assumption of collision-resistant hash functions.

We present an implementation in Haskell of the lambda-auth programming language. In this model of computation, the prover holds the full ADS of type Auth T, which consist of pairs <hi, vi> where vi is any value of type T and hi is its digest, i.e. the hash of the shallow projection of v. The verifier only keeps the digest h of the authenticated data structure.

An example (more in ExampleAuth.hs):

{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveAnyClass #-}
module ExampleAuth where

import Protolude hiding (Hashable)

import Hash
import Authenticated

data Tree a
  = Tip a
  | Bin (Auth (Tree a)) (Auth (Tree a))
  deriving (Eq, Functor, Generic, Generic1, Show, Hashable)

-- | Construct an authenticated branch
bin :: Hashable a => Auth (Tree a) -> Auth (Tree a) -> Auth (Tree a)
bin l r = auth (Bin l r)

-- | Construct an authenticated tip
tip :: Hashable a => a -> Auth (Tree a)
tip v = auth $ Tip v

instance Shallow (Tree a) where
    shallow (Tip s) = Tip s
    shallow (Bin l r) = Bin (shallow l) (shallow r)

data Bit = L | R

fetch
  :: Hashable a
  => [Bit] -- ^ the path to find the element at
  -> Auth (Tree a)
  -> AuthM (Tree a) (Maybe a)
fetch idx authTree = do
  tree <- unAuth authTree
  case (idx, tree) of
    ([]      , Tip s  ) -> return $ Just s
    (L : idx', Bin l _) -> fetch idx' l
    (R : idx', Bin _ r) -> fetch idx' r
    _                   -> return Nothing

tree :: Auth (Tree Text)
tree = bin (bin (tip "b") (bin (tip "c") (bin (tip "d") (tip "c")))) (tip "a")

-- shallow projection of the tree ( just the root hash )
shallowTree :: Auth (Tree Text)
shallowTree = shallow tree

example :: IO ()
example = do
  let proof = snd $ runProver $ fetch [L, R, L] tree
  print $ runVerifier (fetch [L, R, L] shallowTree) proof
  print $ runVerifier (fetch [R] shallowTree) proof -- returns AuthError because hashes don't match


Membership proofs

We also present a method to construct a membership proof for any data structure using GHC.Generics.

An Authable typeclass provides two methods: prove and authenticate. An untrusted source can invoke the prove method to construct a proof of inclusion of an element. A trusted party can verify that the proof of inclusion comes from the expected data source.

data BinTree a
  = Tip a
  | Bin (BinTree a) (BinTree a)
  deriving (Show, Eq, Functor, Generic, Generic1, Authable, Hashable)

myBinTree :: BinTree Int
myBinTree = Bin (Bin (Tip 3) (Bin (Bin (Tip 2) (Tip 5)) (Tip 8))) (Tip 1)

binTreeExample :: IO Bool
binTreeExample = do
  let member = 3
  -- Prove membership
  let proof = prove myBinTree member
  -- Verifier only keeps the hash of the root
  let rootHash = toHash myBinTree
  -- Verify proof
  pure $ verifyProof rootHash proof member

The authenticate method in Authable generates an authenticated data structure from a non-authenticated data structure.

References:

  1. A. Miller, M. Hicks, J. Katz, and E. Shi "Authenticated Data Structures, Generically" (https://www.cs.umd.edu/~mwh/papers/gpads.pdf)

License

Copyright 2018-2019 Adjoint Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].