Questions tagged [hashing]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
38 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
  • 2,617
1 vote
1 answer
151 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
73 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
262 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
174 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
  • 61
2 votes
1 answer
31 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
90 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
252 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
98 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