abla/crypto/ed25519/core
Generated from source.
Source module; follow its importing module's re-export links.
Source: abla/crypto/ed25519/core.ab
ed25519Pointer (fun)
@inline trusted fun ed25519Pointer(address: int): i64*
BEGIN ED25519 SECRET CORE A field element is ten words (40 bytes, x25519's ten limbs), a point four of them (X, Y, Z, T), 160 bytes, x = X/Z, y = Y/Z, xy = T/Z. The work area: +0 the scalar, 32 bytes as given (bit 0 first) +984 zero, an element +64 the point P +1024 x, y, zinv: three elements (to +1144) +224 the accumulator R +1144 the inverse's four elements (to +1304) +384 the sum Q +1304 the pack's two elements (to +1384) +544 eight elements of scratch (to +864) +1384 the encoded point, 32 bytes +864 the multiplication's scratch, 80 bytes +1416 the x's bytes, 32 bytes +944 2d, an element +1448 the entry read from the table, a point (to +1608)
ed25519Load (fun)
@inline trusted fun ed25519Load(address: int): secretU32
Returns the secret 32-bit limb at a readable native address.
ed25519Store (fun)
@inline trusted fun ed25519Store(address: int, value: secretU32): void
Stores the secret 32-bit limb at a writable native address.
ed25519WorkSize (fun)
fun ed25519WorkSize(): int
Returns the required Ed25519 work buffer size in bytes.
ed25519Add (fun)
@noinline trusted fun ed25519Add(out: int, p: int, q: int, w: int): void
out = p + q, the unified addition of the extended coordinates (a = -1): nine multiplications. out may be either operand. w is the work area.
ed25519Double (fun)
@noinline trusted fun ed25519Double(out: int, p: int, w: int): void
out = 2 p (dbl-2008-hwcd, a = -1). out may be p.
ed25519FixedBase (fun)
@noinline trusted fun ed25519FixedBase(w: int, table: int): void
R = scalar * B by a comb: the scalar (32 bytes at w, clamped or reduced: any number below 2^256) is read as four rows of 64 bits, column t of the rows (one bit of each, a digit of four bits) picks one entry of table (sixteen points, entry i the sum of 2^(64 j) B over the bits j of i: ed25519CombTable; the whole table is read), and each of the 64 columns from the top does one doubling and one addition. R is at w + 224.
ed25519Encode (fun)
@noinline trusted fun ed25519Encode(w: int, point: int, out: int): void
The 32-byte encoding of the point at point at out: y, with the low bit of x in bit 255.
ed25519Multiply (fun)
@noinline trusted fun ed25519Multiply(w: int, table: int): void
The scalar (32 bytes at w) times the base point, encoded, at w + 1384, with table as for ed25519FixedBase.
ed25519ModInverse (fun)
@inline fun ed25519ModInverse(m: int): int
Returns the address of the inverse word in an initialized Ed25519 modulus.
ed25519ModSquare (fun)
@inline fun ed25519ModSquare(m: int): int
Returns the address of the squared Montgomery radix in the Ed25519 modulus.
ed25519ModScratch (fun)
@inline fun ed25519ModScratch(m: int): int
Returns the address of the Ed25519 modulus's scratch area.
ed25519LoadLe (fun)
@noinline trusted fun ed25519LoadLe(limbs: int, words: int, bytes: int, count: int): void
The count little-endian bytes at bytes as words words at limbs (the words past the bytes zero).
ed25519StoreLeBody (fun)
@inline trusted fun ed25519StoreLeBody(bytes: int, limbs: int): void
The eight words at limbs as 32 little-endian bytes at bytes.
ed25519StoreLe (fun)
@noinline trusted fun ed25519StoreLe(bytes: int, limbs: int): void
Writes the eight limbs as a 32-byte little-endian value in writable storage.
ed25519ScAdd (fun)
@noinline trusted fun ed25519ScAdd(m: int, out: int, a: int, b: int): void
out = a + b mod L for a and b below L (eight words each). out may be either.
ed25519ScReduce (fun)
@noinline trusted fun ed25519ScReduce(m: int, out: int, hash: int, t: int): void
out = the 64 bytes at hash (little endian) mod L: hi R, lo R and lo from the Montgomery multiplications by R^2 and 1, then hi 2^256 + lo. t has 40 words.
ed25519ScMultiplyAdd (fun)
@noinline trusted fun ed25519ScMultiplyAdd(m: int, out: int, k: int, a: int, r: int, t: int): void
out = r + k * a mod L, for k and r below L (eight words) and a any eight words: k R, then k a, then the sum. t has 8 words.
ed25519PublicKey (fun)
fun ed25519PublicKey(seed: string): CryptoResult
The public key (32 bytes) of a private key (a 32-byte seed): RFC 8032 section 5.1.5.
ed25519Sign (fun)
fun ed25519Sign(seed: string, message: string): CryptoResult
The signature (64 bytes) of message under the private key seed (32 bytes): RFC 8032 section 5.1.6. Deterministic: the same seed and message give the same signature.
ed25519SignWithPublicKey (fun)
fun ed25519SignWithPublicKey(seed: string, publicKey: string, message: string): CryptoResult
As ed25519Sign, with the public key of seed already in hand (ed25519PublicKey(seed), 32 bytes: it is public, so a holder of the key keeps it and saves the multiplication of the base point that recomputing it costs, about half of a signature). A public key that is not the seed's gives a signature that does not verify.
ed25519Verify (fun)
trusted fun ed25519Verify(publicKey: string, message: string, signature: string): bool
Whether signature (64 bytes) is publicKey's signature of message: RFC 8032 section 5.1.7. The check is the strict one: S is below L, the public key is a point with a canonical encoding, and the encoding of [S]B - [k]A is R's bytes (so R is canonical and the cofactor is not cleared). Everything here is public: the doublings are shared by the two scalars, in windows of four bits.
Built from Abla v0.2.79 source ba5d6b7d. Examples and generated signatures follow that source revision.