def sign_with
bend-collections@1.0.0.0 · src/crypto/ed25519/ed25519.bend:44
import bend-collections@1.0.0.0/src/crypto/ed25519/ed25519.bend as Ed25519
import Base
import bend-collections@1.0.0.0/src/crypto/hash.bend as H
import bend-collections@1.0.0.0/src/crypto/ed25519/scalar.bend as SC
import bend-collections@1.0.0.0/src/crypto/ed25519/point.bend as PT
44def sign_with(+c: PT.Cs, +xs: List<&2, U32>, +h: List<&2, U32>, +msg: List<&2, U32>) -> List<&2, U32>:
45 +b = PT.base(c, xs)
46 +a = public_of(c, xs, h)
47 +r = SC.reduce(H.sha512(cat(prefix(h), msg)))
48 +rb = PT.encode(PT.mul(c, r, b))
49 +k = hram(rb, a, msg)
50 cat(rb, SC.mul_add(k, SC.reduce(secret(h)), r))