Skip to main content

Questions tagged [hashing]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
20 views

Compute sha256 hash of a very large input that doesn't fit in one transaction

If I want to compute the sha256 hash of some bytes, I can use solana_program::hashv::hashv, which works fine for a small piece of data that can be hashed in one transaction. Let's say I want to hash ...
Ahri's user avatar
  • 4,150
1 vote
1 answer
30 views

How to get the SHA256 hash of some bytes on chain?

I want to get the SHA256 hash of some bytes in a Solana on-chain program. What's the best practice? Should I use a normal Rust crate like sha256 crate? Or is there any approach that is dedicatedly ...
Yan's user avatar
  • 387
1 vote
0 answers
47 views

On-chain performance of HashSet

How many Compute Units (CU) does it cost to init a HashSet on-chain and perform a contains() check? Intuitively, the limited bpf instruction set will have a high overhead for hashing. Consider these ...
Whiteseal's user avatar
  • 3,185
1 vote
1 answer
168 views

Data Hashing vs Merkle Trees (account compression) on Solana. Which is better for compressing a large data sample?

We are using Solana's hash function: (https://docs.rs/solana-program/1.15.2/solana_program/hash/struct.Hash.html) to compress a large data sample (only strings) it takes thousands of bytes down to a ...
Karsa Witness's user avatar
3 votes
1 answer
96 views

Why can't I use a future blockhash for on-chain randomness?

To my knowledge, Blockhashes are determined by the hash of numerous things involving the instruction data of the transactions involved in the block, and the previous hashes. it is practically ...
Cyrial Kamda's user avatar
1 vote
2 answers
374 views

How can i create hash table using PDAs?

I want to create a hash-table using PDAs with seeds including: i) table-name ii) a u32 integer as key I tried this: #[account( init, payer=user, space = 8 + 1 + 32 + 8 + 8, seeds = [b&...
Mahesh Ghamaand's user avatar
3 votes
1 answer
269 views

What does solana_program::hash actually return?

What does solana_program::hash function return? Supposedly it returns a sha256 Hash value of argument passed, but if I check the same sha256 on a third-party algorithm - it ain't the same. And it's ...
krilin's user avatar
  • 71
2 votes
1 answer
33 views

Is there a transaction instruction verification system in place to avoid verifying user-fed transaction id's in a server?

Is there an efficient way to solve the verification of a particular transaction in the server? For example, I want the user to transfer 100 XYZ tokens. But while confirming the transaction in the ...
zandtifing's user avatar
3 votes
1 answer
96 views

Where are the hashing utils in nodejs?

I'm looking in both @solana/web3.js and @project-serum/anchor and don't see any hashing utils. What should one use to pack and hash data in nodejs? I suppose I could use ethereum/web3.js, but pulling ...
britt's user avatar
  • 103
1 vote
2 answers
412 views

Best way to pack data and then hash it, both in Rust and NodeJS

I'm coming from Ethereum, and in Solidity we can pack data then hash it like keccak256(abi.encodePacked(typed_data1, typed_data2, ....)), and there is a corresponding approach in nodejs ethers.utils....
britt's user avatar
  • 103
1 vote
2 answers
148 views

How would one hash two different pubkeys inside an Anchor program?

I am trying to setup an account constraint as such: #[account( init, payer = creator, space = StateObj::space(), seeds = [ b"some-seed", user_partner0.key()....
TovarishFin's user avatar