Skip to content

Commit

Permalink
feat: into traits for digest
Browse files Browse the repository at this point in the history
  • Loading branch information
irisdv committed Oct 31, 2024
1 parent fc55cf8 commit 4906d1f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ edition = "2024_07"

[dependencies]
starknet = "2.8.4"
utils = { git = "https://github.com/keep-starknet-strange/raito.git" }

[dev-dependencies]
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.31.0" }
Expand Down
12 changes: 12 additions & 0 deletions src/utils/hash.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ pub impl DigestImpl of DigestTrait {
}
}

pub impl UtuDigestIntoRaito of Into<Digest, utils::hash::Digest> {
fn into(self: Digest) -> utils::hash::Digest {
utils::hash::Digest { value: self.value }
}
}

pub impl RaitoDigestIntoUtu of Into<utils::hash::Digest, Digest> {
fn into(self: utils::hash::Digest) -> Digest {
Digest { value: self.value }
}
}

impl DigestZero of Zero<Digest> {
fn zero() -> Digest {
Digest { value: [0_u32; 8] }
Expand Down

0 comments on commit 4906d1f

Please sign in to comment.