8 votes
Accepted

What block hash function and transaction signature method does EOS use?

Block producers use SHA-256 to generate the digest and ECDSA to sign the block. Producers may sign using a K1 key (secp256k1 curve, used by Bitcoin) or an R1 key (P-256 curve, a NIST standard). ...
Todd Fleming's user avatar
  • 2,005
7 votes
Accepted

Is the block digest c++ specific?

Here's how the C++ code calculates the block digest: digest_type::hash(*this) serializes the block into a binary form, then runs the binary through sha-256. block.hpp#L125 identifies the order that ...
Todd Fleming's user avatar
  • 2,005
4 votes

Cryptographic Operations in Smart Contracts?

Yes! It's very much possible! Look at the Dice contract example on the eosio github or in the repo folder eos/contracts/dice The function shown is a sha256 hashing method called sha256( ) Link to ...
Joshua Shope's user avatar
4 votes

What are the formats for the pub key/priv key/signatures?

Private Keys are typically encoded using WIF (Wallet Import Format). The Public Keys are likewise encoded in WIF format, but with the EOS prefix added to them. To obtain the actual ECC keys, the ...
John Haager's user avatar
  • 1,844
4 votes

Which encryption algorithm EOSIO uses

Bitcoin, Ethereum or EOS uses secp256k1 algorithm. Not approximately, but exactly same. You can derive Ethereum address from EOS private key and sign Ethereum transaction. One difference between EOS ...
conr2d's user avatar
  • 2,320
3 votes

Encrypting with a public key

Yes, but you would encrypt and decrypt off-chain while only storing the encrypted data and other necessary data in the blockchain state. With eosjs, you can use the following set of commands to ...
confused00's user avatar
  • 5,554
2 votes

What are the formats for the pub key/priv key/signatures?

The encryption is sha256 hash with a 32 byte buffer or string with encoding defaulting to UTF-8. Here's a link to the official repository for the elliptic curve functions which should be able to give ...
altShiftDev's user avatar
  • 1,135
2 votes
Accepted

Cryptographic Operations in Smart Contracts?

There's a crypto.h inside of the contracts/eosiolib folder that has SHA/ripemd methods. AES should be done off-chain though since the cleartext would be visible to anyone replaying the blockchain ...
nsjames's user avatar
  • 453
2 votes
Accepted

eosjs ecc sha256 produce different hash than the EOS cpp sha256

Check the output of JSON.stringify, I think you'll be surprised to see that it adds quotation marks around the string. "Hello" is not the same as JSON.stringify("Hello") JSON.stringify("Hello")=="\"...
Ami Heines's user avatar
  • 1,686
2 votes
Accepted

How reproduce sha256 in Javascript?

xxd make a hexdump or do the reverse -r revert, convert hexdump into binary -p output 'plain hexdump style' sha256sum compute and check SHA256 message digest -b read in binary mode Here ...
Don's user avatar
  • 1,165
2 votes

Trouble using EOSIO built in crypto library (can't resolve headers)

The correct library is now #include <eosio/crypto.hpp>
MegaBeans's user avatar
1 vote
Accepted

Why are the EOS private key/public key both 33-byte(compress mode)?

As the link in your comment explain, 0x80 prefix is Bitcoin convention. (indicating Bitcoin mainnet) Due to characteristics of elliptic curve, there are only two points which share same x-coordinate. ...
conr2d's user avatar
  • 2,320
1 vote

Which encryption algorithm EOSIO uses

EOS also uses Elliptic curve cryptography for more you can refer https://github.com/EOSIO/eosjs-ecc
Mr.Y's user avatar
  • 957
1 vote
Accepted

Is there any API in EOS Smart Contract to decrypt message?

Don't really get what you're trying to build but here's the cryptoapi.
cmadh's user avatar
  • 1,929
1 vote

Encrypting with a public key

Some sexy dude made this library https://github.com/dtrades/dtrades-communication Let's you encrypt a string with a public key, decrypt with the corresponding private. import { encrypt, decrypt } ...
John Williamson's user avatar
1 vote

Cryptographic Operations in Smart Contracts?

Yes, it is possible. Please see here: https://github.com/EOSIO/eos/blob/master/contracts/eosiolib/crypto.h Developers can also compile their favourite C/C++ crypto library to do things EOSIO natively ...
Sergey Metelin's user avatar
1 vote

Cryptographic Operations in Smart Contracts?

The operations in contracts should be as short as possible. Because it’s directly pertain to the block producing time. I recommend you to do cryptographic things outside of contract and pass the ...
1 vote

What are the formats for the pub key/priv key/signatures?

Although the answers here are technically correct they lack any real details, so since I've recently had to do this myself, I thought I'd share the real nuts and bolts. An EOS private key is WIF ...
The Welder's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible