Ed25519怎么工作的

Ed25519 is an elliptic curve signature scheme that is known for its high performance and security. It is widely used in modern cryptography for generating public-private key pairs and digital signatures. Here’s a breakdown of how Ed25519 works:

Key Generation

Seed Generation:

  1. A random 256-bit seed is generated. This seed is the private key in its raw form.

Private Key:

  1. The seed is hashed using the SHA-512 hash function to produce a 512-bit hash.
  2. The first 256 bits of this hash are used to form the private key scalar k. Some bits of this scalar are fixed to ensure certain mathematical properties (clamping).

Public Key:

  1. The private key scalar k is then multiplied by a predefined point on the elliptic curve (base point B) to produce the public key A. This is done using elliptic curve point multiplication.
  2. The result of this multiplication is the public key, which is a point on the curve.

Signing

Message Hashing:

  1. The message to be signed is hashed with SHA-512 along with the second half of the 512-bit hash from the private key generation. This produces a deterministic value r.

Random Value:

  1. The value r is reduced modulo the curve order to produce a scalar R.
  2. This scalar R is then multiplied by the base point B to get an elliptic curve point R (the nonce).

Signature Calculation:

  1. The public key A, the elliptic curve point R, and the message are hashed together using SHA-512 to produce a new hash value h.
  2. The scalar s is computed as s = r + h * k, where r is the deterministic value from step 1, h is the hash from this step, and k is the private key scalar.
  3. The signature is the combination of the point R and the scalar s.

Verification

Signature Verification:

  1. To verify a signature, the verifier needs the public key A, the message, and the signature (R, s).
  2. The verifier calculates the hash h from the public key A, the elliptic curve point R, and the message.
  3. The verifier checks the equation sB = R + hA using elliptic curve arithmetic. If this equation holds, the signature is valid.

Advantages of Ed25519

  1. High Performance: Ed25519 is designed to be fast in both key generation and signature verification.
  2. Security: The curve used in Ed25519 has strong security properties, making it resistant to known cryptographic attacks.
  3. Deterministic Signatures: The use of deterministic signing (based on hashing the message with part of the private key) eliminates the risks associated with poor randomness in signature generation.
  4. Compact Size: Both keys and signatures are relatively small, which is efficient for storage and transmission.

In summary, Ed25519 leverages strong cryptographic principles and efficient algorithms to provide a secure and fast signature scheme, making it ideal for use in applications like Solana.

  • 19
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

0010000100

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值