Function fromString [src]

Hash a context ctx and a string s into an Edwards25519 point This function implements the edwards25519_XMD:SHA-512_ELL2_RO_ and edwards25519_XMD:SHA-512_ELL2_NU_ methods from the "Hashing to Elliptic Curves" standard document. Although not strictly required by the standard, it is recommended to avoid NUL characters in the context in order to be compatible with other implementations.

Prototype

pub fn fromString(comptime random_oracle: bool, ctx: []const u8, s: []const u8) Edwards25519

Parameters

random_oracle: boolctx: []const u8s: []const u8

Source

pub fn fromString(comptime random_oracle: bool, ctx: []const u8, s: []const u8) Edwards25519 { if (random_oracle) { const px = stringToPoints(2, ctx, s); return px[0].add(px[1]); } else { return stringToPoints(1, ctx, s)[0]; } }