Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On the issue of encoding selection when signing with sign #10

Closed
yuwaixingtian opened this issue Aug 24, 2024 · 2 comments
Closed

On the issue of encoding selection when signing with sign #10

yuwaixingtian opened this issue Aug 24, 2024 · 2 comments

Comments

@yuwaixingtian
Copy link

yuwaixingtian commented Aug 24, 2024

$ecc = new EasyECC('K256');

$alice_sk = $ecc -> generatePrivateKey();

$alice_pk = $alice_sk -> getPublicKey() -> toString();

$pk = bin2hex($alice_pk);
$sign_dat = $ecc -> sign($data, $alice_sk, false);//I would like to know if you have a way to encode this place as sha256?

Because I observed the project and found the sign method in EasyECC.php:

$kGen = new HedgedRandomNumberGenerator(
        EccFactory::getAdapter(),
        $privateKey,
       $hash,
      'sha384'
 ); 

It seems to be fixedly designated as sha384

@paragonie-security
Copy link
Contributor

Oh, that's a good point.

@paragonie-security
Copy link
Contributor

paragonie-security commented Sep 3, 2024

Fixed in v1.2.0

Just update to the latest version and your code will use the correct hash function for your ECDSA algorithm (SHA256 for secp256k1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants