Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jgcrosta committed Sep 20, 2023
1 parent b652537 commit e1a02a1
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test-cases/hash-encoded/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Function `hash_encoded`

```rust
pub fn hash_encoded<H, T>(input: &T, output: &mut <H as HashOutput>::Type)
```

## Description

The `hash_encoded` module offers the capability to first encode the given input using SCALE encoding and then compute its cryptographic hash using the specified hash function. The `hash_encoded` function is integral for operations where encoded data needs to be verified or its integrity ensured through hashing.

## Related ink! functions

- [`hash_encoded`](https://paritytech.github.io/ink/ink_env/fn.hash_encoded.html)

## Test case

Both the integration tests and end-to-end tests in the `hash_encoded` module verify the hashing and encoding functionality of the contract. Each test ensures that the corresponding hash function produces the expected hash output for a given input.

## Comparison Integration vs E2E

The function `hash_encoded` has been successfully validated in both integration and end-to-end test scenarios, demonstrating its robustness and consistent implementation.

| # | Test | Integration | E2E |
| --- | ------------------------------------------------------ | :---------: | :-: |
| 1 | Attempts to get the hash using the method `sha_256` |||
| 2 | Attempts to get the hash using the method `blake_128` |||
| 3 | Attempts to get the hash using the method `blake_256` |||
| 4 | Attempts to get the hash using the method `keccak_256` |||

## Result

- This functionality is implemented and works as expected

0 comments on commit e1a02a1

Please sign in to comment.