Zcash 백서

Zcash

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 35쪽 중 14쪽

e 𝑥↦→𝑥 3 would not be a permutation. 𝛼= 5 is the smallest integer for which 𝑥↦→𝑥 𝛼 is a permutation inF 𝑞P. On the other hand, the number of rounds chosen includes a significant security margin, even taking into account these considerations. For small 𝑡, such as 𝑡= 3 as used here, the results of [KR2020] are positive for security since they indicate that the number of active S-boxes through the middle rounds is larger than originally estimated by thePoseidon designers (and the number of rounds is based on this original conservative estimate). Also note that the use of Poseidon in Orchardis very conservative. First, the sponge mode limits an adversary to only being able to influence part of the Poseidon permutation input, and we use it only to construct a PRF (PRFnfOrchard as described in §5.4.2 ‘Pseudo Random Functions’ on p. 89). Half of the sponge input is a random key nk, known only to holders of afull viewing key, and the remaining half ρ comes from a previous nullifierwhich is effectively a randomaffine-short-Weierstrass 𝑥-coordinate on thePallas curve. Then the PRF is used to enhance the security of a discrete-logarithm-based nullifier construction (described in [Zcash-Orchard, Section 3.5 Nullifiers]) against a potential discrete-log-breaking adversary. Given the weak assumption that the PoseidonHash sponge produces output that preserves sufficient entropy from the inputs nk and ρ, this nullifier construction would still be secure under aDecisional Diffie–Hellman assumptionon thePallascurve, even if thePoseidon-based PRF were distinguishable from an ideal PRF. • The constant 265 comes from [GKRRS2019, section 4.2]: “Constant-Input-Length Hashing. The capacity value is length·(2 64) + (𝑜−1) where 𝑜 is the output length. ” In this case the input length (length) is 2 field elements, and the output length is1field element. 5.4.1.11 Equihash Generator #equihashgen EquihashGen𝑛,𝑘 is a specializedhash functionthat maps an input and an index to an output of length 𝑛 bits. It is used in §7.7.1 ‘Equihash’ on p.139. Letpowtag:= 64-bit“ ZcashPoW” 32-bit𝑛 32-bit𝑘 . Letpowcount(𝑔) := 32-bit𝑔 . LetEquihashGen 𝑛,𝑘(𝑆, 𝑖) :=𝑇ℎ+1.. ℎ+𝑛, where 𝑚=floor (︀ 512 𝑛 )︀ ; ℎ= (𝑖−1 mod𝑚)·𝑛; 𝑇=BLAKE2b-(𝑛·𝑚) (︀ powtag, 𝑆||powcount(floor (︀ 𝑖−1 𝑚 )︀ ) )︀ . Indices of bits in𝑇are 1-based. BLAKE2b-ℓ(𝑝, 𝑥)is defined in §5.4.1.2 ‘BLAKE2 Hash Functions’ on p.79. 88 Security requirement: BLAKE2b-ℓ(powtag, 𝑥)must generate output that is sufficiently unpredictable to avoid short-cuts to theEquihashsolution process. It would suffice to model it as arandom oracle. Note:When EquihashGen is evaluated for sequential indices, as in theEquihashsolving process ( §7.7.1 ‘Equihash’ on p. 139), the number of calls to BLAKE2b can be reduced by a factor offloor (︀ 512 𝑛 )︀ in the best case (which is a factor of 2 for𝑛= 200). 5.4.2 Pseudo Random Functions #concreteprfs Let SHA256Compress be as given in §5.4.1.1 ‘SHA-256,SHA-256d,SHA256Compress, andSHA-512Hash Functions’ on p.78. ThePseudo Random Functions PRFaddr, PRFnfSprout, PRFpk, and PRFρ from §4.1.2 ‘Pseudo Random Functions’ on p.26, are all instantiated usingSHA256Compress: PRFaddr𝑥 (𝑡) :=SHA256Compress (︁ 1 1 0 0 252-bit𝑥 8-bit𝑡 [0]248 )︁ PRFnfSproutask (ρ) :=SHA256Compress (︁ 1 1 1 0 252-bita sk 256-bitρ )︁ PRFpkask(𝑖,h Sig) :=SHA256Compress (︁ 0 𝑖-1 0 0 252-bita sk 256-bith Sig )︁ PRFρφ(𝑖,h Sig) :=SHA256Compress (︁ 0 𝑖-1 1 0 252-bitφ 256-bith Sig )︁ Security requirements: •SHA256Compressmust becollision-resistant. •SHA256Compress must be aPRFwhen keyed by the bits corresponding to 𝑥, ask or φ in the above diagrams, with input in the remaining bits. Note:The first four bits –i.e. the most significant four bits of the first byte– are used to separate distinct uses of SHA256Compress, ensuring that the functions are independent. As well as the inputs shown here, bits 1011 in this position are used to distinguish uses of the full SHA-256 hash function; see §5.4.8.1 ‘Note Commitments (Sprout)’ on p.98. (The specific bit patterns chosen here were motivated by the possibility of future extensions that might have increased Nold and/or Nnew to 3, or added an additional bit to ask to encode a new key type, or that would have required an additionalPRF. In fact since Saplingswitches to non-SHA256Compress-based cryptographic primitives, these extensions are unlikely to be necessary.) PRFexpand is used in §4.2.2 ‘Sapling Key Components’ on p. 38 to derive theSpend authorizing key ask and theproof authorizing keynsk. It is instantiated using theBLAKE2bhash functiondefined in §5.4.1.2 ‘BLAKE2 Hash Functions’ on p.79: PRFexpandsk (𝑡) :=BLAKE2b-512(“ Zcash_ExpandSeed”,LEBS2OSP 256(sk)||𝑡) Security requirement: BLAKE2b-512(“Zcash_ExpandSeed”,LEBS2OSP 256(sk)||𝑡) must be aPRFfor output range BY Y[ℓPRFexpand/8] when keyed by the bits corresponding tosk, with input in the bits corresponding to𝑡. PRFockSapling is used in §4.20.1 ‘Encryption (Sapling and Orchard)’ on p. 70 to derive theoutgoing cipher key ock used to encrypt anoutgoing ciphertext. It is instantiated using theBLAKE2bhash functiondefined in §5.4.1.2 ‘BLAKE2 Hash Functions’ on p.79: PRFockSaplingovk (cv, cmu, ephemeralKey) :=BLAKE2b-256(“ Zcash_Derive_ock”,ockInput) whereockInput= LEBS2OSP256(ovk) 32-byte cv 32-byte cmu 32-byte ephemeralKey . 89 Security requirement: BLAKE2b-512(“Zcash_Derive_ock”,ockInput) must be a PRF for output range Sym.K (de- fined in §5.4.3 ‘Symmetric Encryption’ on p. 91) when keyed by the bits corresponding to ovk, with input in the bits corresponding to cv, cmu, and ephemeralKey. PRFnfSapling is used to derive thenullifierfor a Sapling-pool note. It is instantiated using the BLAKE2s hash function defined in §5.4.1.2 ‘BLAKE2 Hash Functions’ on p.79: PRFnfSaplingnk⋆ (ρ⋆) :=BLAKE2s-256 (︁“Zcash_nf”, LEBS2OSP256(nk⋆) LEBS2OSP256(ρ⋆) )︁. Security requirement:The function BLAKE2s-256 (︁ “Zcash_nf”, LEBS2OSP256(nk⋆) LEBS2OSP256(ρ⋆) )︁ must be acollision-resistant PRFfor output range BY Y[32] when keyed by the bits corresponding to nk⋆, with input in the bits corresponding to ρ⋆. Note that nk⋆ J⋆ (𝑟) is a representation of a point in the 𝑟J-order subgroup of the Jubjub curve, and therefore is not uniformly distributed onB [ℓJ].J ⋆(𝑟) is defined in §5.4.9.3 ‘Jubjub’ on p.105. PRFockOrchard is used in §4.20.1 ‘Encryption (Sapling and Orchard)’ on p. 70 to derive theoutgoing cipher key ock used to encrypt anoutgoing ciphertext. It is instantiated using theBLAKE2bhash functiondefined in §5.4.1.2 ‘BLAKE2 Hash Functions’ on p.79: PRFockOrchardovk (cv, cmx, ephemeralKey) :=BLAKE2b-256(“ Zcash_Orchardock”,ockInput) whereockInput= LEBS2OSP256(ovk) 32-byte cv 32-byte cmx 32-byte ephemeralKey . Security requirement: BLAKE2b-512(“Zcash_Orchardock”,ockInput) must be a PRF for output range Sym.K (de- fined in §5.4.3 ‘Symmetric Encryption’ on p. 91) when keyed by the bits corresponding to ovk, with input in the bits corresponding to cv, cmx, and ephemeralKey. Let𝑞 P be as defined in §5.4.9.6 ‘Pallas and Vesta’ on p.108. PRFnfOrchard F𝑞P×F 𝑞P→F 𝑞P is used as part of deriving thenullifierfor anOrchard-poolnote. It is instantiated using the PoseidonHash hash function [GKRRS2019] defined in §5.4.1.10 ‘PoseidonHashFunction’ on p.87: PRFnfOrchardnk (ρ) :=PoseidonHash(nk,ρ). Security requirement: PoseidonHash F𝑞P×F 𝑞P→F 𝑞P must be a PRF when keyed by its first argument, with its second argument as input. Non-normative notes: • This construction of a PRF from a sponge is described in [BDPA2011, section 3.12]. It is called “outer-keyed sponge” in [ADMA2015], or “black-box keying” in [GPT2015]. The results of these papers do not directly apply because the key is smaller than the rate. However, the result of [GG2015] provides evidence for the security of this construction (even if it technically considers a situation in which the distinguishing adversary cannot evaluate the full permutation). •See §5.4.1.10 ‘PoseidonHashFunction’ on p.87 for further security discussion of how OrchardusesPoseidon. 90 5.4.3 Symmetric Encryption #concretesym LetSym.K:=B [256],Sym.P:=B Y Y[N], andSym.C:=B Y Y[N]. Let theauthenticated one-time symmetric encryption scheme Sym.EncryptK(P) be authenticated encryption using AEAD_CHACHA20_POLY1305[RFC-7539] encryption of plaintext P∈Sym.P , with empty “associated data" , all-zero nonce[0] 96, and256-bit keyK∈Sym.K. Similarly, let Sym.DecryptK(C) be AEAD_CHACHA20_POLY1305 decryption of ciphertext C∈Sym.C , with empty “associated data" , all-zero nonce[0]96, and 256-bit key K∈Sym.K . The result is either the plaintextbyte sequence, or⊥indicating failure to decrypt. Note:The “IETF" definition of AEAD_CHACHA20_POLY1305from [RFC-7539] is used; this has a32-bit block count and a96-bit nonce, rather than a64-bit block count and64-bit nonce as in the original definition ofChaCha20. 5.4.4 Pseudo Random Permutations #concreteprps Letℓ dk andℓ d be as defined in §5.3 ‘Constants’ on p.77. PRPd BY Y[ℓdk/8]×B [ℓd]→B [ℓd] is aPseudo Random Permutationspecified in §4.1.3 ‘Pseudo Random Permutations’ on p. 28. In this specification, it is used to generatediversifiersfor Orchardshielded payment addressesin §4.2.3 ‘Orchard Key Components’ on p. 40. ( [ZIP-32] uses an identical construction to generatediversifiersfor Sapling shielded payment addresses.) Let FF1-AES256𝐾(tweak, 𝑥)be the FF1 format-preserving encryption algorithm [NIST2016] using AES with a 256-bit key 𝐾, and parameters radix= 2,minlen= 88,maxlen= 88 . It will be used only with the empty string “” as the tweak.𝑥is a sequence of88bits, as is the output. DefinePRP d𝐾(d) :=FF1-AES256 𝐾(“”,d). Security requirement:FF1-AES256with tweak fixed to“ ”must be a securePseudo Random Permutation. Non-normative note: [DKLS2020] describes attacks against FF1 that are practical for some parameterizations. However, for an88-bit domain, and 10 rounds as specified in [NIST2016], even the distinguishing attack is no better than a brute force search for the 256-bit key. Specifically we have 𝑟= 5 (half the number of rounds) and 𝑛= 44 (half the domain size in bits), so according to [DKLS2020, section 4.2] the data complexity is 22𝑛((𝑟−1)− 12 )−𝑛 = 2264, and the time complexity is2 2𝑛((𝑟−1)− 12 ) = 2308. 5.4.5 Key Agreement And Derivation #concretekaandkdf 5.4.5.1SproutKey Agreement #concretesproutkeyagreement KASprout is akey agreement schemeas specified in §4.1.5 ‘Key Agreement’ on p.28. It is instantiated asCurve25519key agreement, described in [Bernstein2006], as follows. Let KASprout.Public and KASprout.SharedSecret be the type of Curve25519 public keys(i.e. BY Y[32]), and let KASprout.Private be the type ofCurve25519secret keys. Let Curve25519(𝑛, 𝑞) be the result of point multiplication of the Curve25519 public keyrepresented by the byte se- quence 𝑞 by the Curve25519 secret key represented by thebyte sequence 𝑛, as defined in [Bernstein2006, section 2]. LetKA Sprout.Base:= 9 be the publicbyte sequencerepresenting theCurve25519base point. Let clampCurve25519(𝑥) take a 32-byte sequence 𝑥 as input and return abyte sequencerepresenting a Curve25519 private key, with bits “clamped” as described in [Bernstein2006, section 3]: “clear bits 0,1,2 of the first byte, clear bit 7 of the last byte, and set bit 6 of the last byte. ” Here the bits of a byte are numbered such that bit𝑏 has numeric weight2 𝑏. 91 DefineKA Sprout.FormatPrivate(𝑥) :=clamp Curve25519(𝑥). DefineKA Sprout.DerivePublic(𝑛, 𝑞) :=Curve25519(𝑛, 𝑞). DefineKA Sprout.Agree(𝑛, 𝑞) :=Curve25519(𝑛, 𝑞). 5.4.5.2SproutKey Derivation #concretesproutkdf KDFSprout is aKey Derivation Functionas specified in §4.1.6 ‘Key Derivation’ on p.29. It is instantiated usingBLAKE2b-256as follows: KDFSprout(𝑖,h Sig,sharedSecret 𝑖,epk,pk newenc,𝑖) :=BLAKE2b-256(kdftag,kdfinput) where: kdftag:= 64-bit“ ZcashKDF” 8-bit𝑖−1 [0]56 kdfinput:= 256-bith Sig 256-bitsharedSecret 𝑖 256-bitepk 256-bitpk newenc,𝑖 . BLAKE2b-256(𝑝, 𝑥)is defined in §5.4.1.2 ‘BLAKE2 Hash Functions’ on p.79. 5.4.5.3SaplingKey Agreement #concretesaplingkeyagreement KASapling is akey agreement schemeas specified in §4.1.5 ‘Key Agreement’ on p.28. It is instantiated as Diffie–Hellman with cofactor multiplication onJubjubas follows: LetJ,J (𝑟),J (𝑟)*, and the cofactorℎ J be as defined in §5.4.9.3 ‘Jubjub’ on p.105. DefineKA Sapling.Public:=J. DefineKA Sapling.PublicPrimeOrder:=J (𝑟)*. DefineKA Sapling.SharedSecret:=J (𝑟). DefineKA Sapling.Private:=F 𝑟J. DefineKA Sapling.DerivePublic(sk, 𝐵) :=[sk]𝐵. DefineKA Sapling.Agree(sk, 𝑃) :=[ℎJ·sk]𝑃. 5.4.5.4SaplingKey Derivation #concretesaplingkdf KDFSapling is aKey Derivation Functionas specified in §4.1.6 ‘Key Derivation’ on p.29. It is instantiated usingBLAKE2b-256as follows: KDFSapling(sharedSecret, ephemeralKey) :=BLAKE2b-256(“ Zcash_SaplingKDF”,kdfinput). where: kdfinput:= LEBS2OSP256 (︀ reprJ(sharedSecret) )︀ ephemeralKey . BLAKE2b-256(𝑝, 𝑥)is defined in §5.4.1.2 ‘BLAKE2 Hash Functions’ on p.79. 92 5.4.5.5OrchardKey Agreement #concreteorchardkeyagreement KAOrchard is akey agreement schemeas specified in §4.1.5 ‘Key Agreement’ on p.28. It is instantiated as Diffie–Hellman onPallasas follows: LetPbe as defined in §5.4.9.6 ‘Pallas and Vesta’ on p.108. DefineKA Orchard.Public:=P *. DefineKA Orchard.PublicPrimeOrder:=P *. DefineKA Orchard.SharedSecret:=P *. DefineKA Orchard.Private:=F *𝑟P. DefineKA Orchard.DerivePublic(sk, 𝐵) :=[sk]𝐵. DefineKA Orchard.Agree(sk, 𝑃) :=[sk]𝑃. 5.4.5.6OrchardKey Derivation #concreteorchardkdf KDFOrchard is aKey Derivation Functionas specified in §4.1.6 ‘Key Derivation’ on p.29. It is instantiated usingBLAKE2b-256as follows: KDFOrchard(sharedSecret, ephemeralKey) :=BLAKE2b-256(“ Zcash_OrchardKDF”,kdfinput). where: kdfinput:= LEBS2OSP256(reprP(sharedSecret) ) ephemeralKey . BLAKE2b-256(𝑝, 𝑥)is defined in §5.4.1.2 ‘BLAKE2 Hash Functions’ on p.79. 5.4.6Ed25519 #concreteed25519 Ed25519is asignature schemeas specified in §4.1.7 ‘Signature’ on p. 29. It is used to instantiate JoinSplitSig as described in §4.11 ‘Non-malleability (Sprout)’ on p.54. LetPreCanopyExcludedPointEncodings P (︀ BY Y[32])︀ ={ [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ], [ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ], [ 0x26, 0xe8, 0x95, 0x8f, 0xc2, 0xb2, 0x27, 0xb0, 0x45, 0xc3, 0xf4, 0x89, 0xf2, 0xef, 0x98, 0xf0, 0xd5, 0xdf, 0xac, 0x05, 0xd3, 0xc6, 0x33, 0x39, 0xb1, 0x38, 0x02, 0x88, 0x6d, 0x53, 0xfc, 0x05 ], [ 0xc7, 0x17, 0x6a, 0x70, 0x3d, 0x4d, 0xd8, 0x4f, 0xba, 0x3c, 0x0b, 0x76, 0x0d, 0x10, 0x67, 0x0f, 0x2a, 0x20, 0x53, 0xfa, 0x2c, 0x39, 0xcc, 0xc6, 0x4e, 0xc7, 0xfd, 0x77, 0x92, 0xac, 0x03, 0x7a ], [ 0x13, 0xe8, 0x95, 0x8f, 0xc2, 0xb2, 0x27, 0xb0, 0x45, 0xc3, 0xf4, 0x89, 0xf2, 0xef, 0x98, 0xf0, 0xd5, 0xdf, 0xac, 0x05, 0xd3, 0xc6, 0x33, 0x39, 0xb1, 0x38, 0x02, 0x88, 0x6d, 0x53, 0xfc, 0x85 ], [ 0xb4, 0x17, 0x6a, 0x70, 0x3d, 0x4d, 0xd8, 0x4f, 0xba, 0x3c, 0x0b, 0x76, 0x0d, 0x10, 0x67, 0x0f, 0x2a, 0x20, 0x53, 0xfa, 0x2c, 0x39, 0xcc, 0xc6, 0x4e, 0xc7, 0xfd, 0x77, 0x92, 0xac, 0x03, 0xfa ], [ 0xec, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f ], [ 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f ], [ 0xee, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f ], [ 0xd9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff ], [ 0xda, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff ] }. Let𝑝= 2 255−19. Let𝑎=−1. Let𝑑=−121665/121666 (mod𝑝). Let ℓ= 2 252 + 27742317777372353535851937790883648493 (the order of theEd25519curve’sprime-order subgroup). 93 Let𝐵be the base point given in [BDLSY2012]. Define the notation ?√∙ as in §2 ‘Notation’ on p.11. DefineI2LEOSP,LEOS2BSP, andLEBS2IPas in §5.1 ‘Integers, Bit Sequences, and Endianness’ on p.76. Define reprBytesEd25519 Ed25519→B Y Y[32] such that reprBytesEd25519((𝑥, 𝑦))=I2LEOSP256(︀(𝑦mod𝑝) + 2 255·˜𝑥)︀, where ˜𝑥=𝑥mod 2. 10 DefineabstBytes Ed25519 BY Y[32]→Ed25519∪{⊥}such thatabstBytes Ed25519(︀𝑃 )︀is computed as follows: let𝑦⋆ B[255] be the first255bits ofLEOS2BSP 256(︀𝑃 )︀ and let˜𝑥 Bbe the last bit. let𝑦 F𝑝 =LEBS2IP 255(𝑦⋆) (mod𝑝). let𝑥= ? √︂ 1−𝑦 2 𝑎−𝑑·𝑦 2 . (The denominator𝑎−𝑑·𝑦 2 cannot be zero, since 𝑎𝑑 is not square inF 𝑝.) if𝑥=⊥, return⊥. if𝑥mod 2 = ˜𝑥then return(𝑥, 𝑦)else return(𝑝−𝑥, 𝑦). Note:This definition of point decoding differs from that of [RFC-8032, section 5.1.3, as corrected by the errata]. In the latter there is an additional step “If x = 0, and x_0 = 1, decoding fails. ” , which rejects the encodings{ [ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80 ], [ 0xee, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff ], [ 0xec, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff ] }. In this specification, the first two of these are accepted as encodings of (0,1) , and the third is accepted as an encoding of(0,−1). Ed25519is defined as in [BDLSY2012], using SHA-512 as the internalhash function, with the additional requirements below. A validEd25519validating keyis defined as a sequence of32bytes encoding a point on theEd25519curve. The requirements on a signature(𝑅 , 𝑆)withvalidating key𝐴 on a message𝑀are: •𝑆 MUSTrepresent an integer less thanℓ. •𝑅 and𝐴 MUSTbe encodings of points𝑅and𝐴respectively on theEd25519curve; •[Pre-Canopy]𝑅 MUST NOTbe inPreCanopyExcludedPointEncodings; •[Pre-Canopy] The validation equationMUSTbe equivalent to[𝑆]𝐵=𝑅+[𝑐]𝐴. • [Canopyonward] The validation equationMUSTbe equivalent to [8] [𝑆]𝐵=[8]𝑅+[8] [𝑐]𝐴 for single- signature validation. where𝑐is computed as the integer corresponding toSHA-512(𝑅 ||𝐴||𝑀)as specified in [BDLSY2012]. If these requirements are not met or the validation equation does not hold, then the signature is considered invalid. The encoding of anEd25519signature is: 256-bit𝑅 256-bit𝑆 where𝑅 and𝑆 are as defined in [BDLSY2012]. 10Here we use the (𝑥, 𝑦)naming of coordinates in [BDLSY2012], which is different from the (𝑢,v) naming used for coordinates ofctEdwards curvesin §5.4.9.3 ‘Jubjub’ on p.105 and in §A.2 ‘Elliptic curve background’ on p.207. 94 Notes: • It is not required that the integer encoding of the 𝑦-coordinate10 of the points represented by 𝑅 or 𝐴 are less than2 255−19. •It is not required that𝐴 ̸∈PreCanopyExcludedPointEncodings. • [Canopyonward] Appendix §B.3 ‘Ed25519batch validation’ on p. 230 describes an optimization thatMAY be used to speed up validation of batches ofEd25519signatures. Non-normative note:The exclusion, beforeCanopyactivation, of PreCanopyExcludedPointEncodings from 𝑅 is due to a quirk of version 1.0.15 of the libsodium library [libsodium] which was initially used to implementEd25519 signature validation in zcashd. (The ED25519_COMPAT compile-time option was not set.) The intent was to exclude points of order less thanℓ; however, not all such points were covered. [Canopyonward]Non-normative note:Because
프로젝트로 돌아가기