*
* @param h FieldElement destination
*/
-//@ts-expect-error
-@inline
export function fe_0 (h: FieldElement): void {
memory.fill(changetype<usize>(h), 0, 48)
}
*
* @param h FieldElement destination
*/
-//@ts-expect-error
-@inline
export function fe_1 (h: FieldElement): void {
fe_0(h)
h[0] = 1
* @param f FieldElement summand source
* @param g FieldElement summand source
*/
-//@ts-expect-error
-@inline
export function fe_add (h: FieldElement, f: FieldElement, g: FieldElement): void {
const h_ptr = changetype<usize>(h)
const f_ptr = changetype<usize>(f)
* @param {FieldElement} g source
* @param {u64} b Copy `g` into `f` if 1, copy `f` into `f` if 0
*/
-//@ts-expect-error
-@inline
export function fe_cmov (f: FieldElement, g: FieldElement, b: u64): void {
const f_ptr = changetype<usize>(f)
const g_ptr = changetype<usize>(g)
* @param {FieldElement} h destination
* @param {FieldElement} f source
*/
-//@ts-expect-error
-@inline
export function fe_copy (h: FieldElement, f: FieldElement): void {
memory.copy(changetype<usize>(h), changetype<usize>(f), 40)
}
* @param h FieldElement sum destination
* @param f FieldElement summand source
*/
-//@ts-expect-error
-@inline
export function fe_dbl (h: FieldElement, f: FieldElement): void {
const h_ptr = changetype<usize>(h)
const f_ptr = changetype<usize>(f)
* Preconditions:
* |f| bounded by 1.1x2²⁶,1.1x2²⁵,1.1x2²⁶,1.1x2²⁵,etc.
*/
-//@ts-expect-error
-@inline
export function fe_isnegative (f: FieldElement): u8 {
const t = fe_isnegative_t
fe_reduce(t, f)
* Preconditions:
* |f| bounded by 1.1x2²⁶,1.1x2²⁵,1.1x2²⁶,1.1x2²⁵,etc.
*/
-//@ts-expect-error
-@inline
export function fe_iszero (f: FieldElement): u8 {
const s = fe_iszero_s
fe_tobytes(s, f)
* @param {FieldElement} h result destination
* @param {FieldElement} f operand source
*/
-//@ts-expect-error
-@inline
export function fe_neg (h: FieldElement, f: FieldElement): void {
const h_ptr = changetype<usize>(h)
const f_ptr = changetype<usize>(f)
* @param f FieldElement minuend source
* @param g FieldElement subtrahend source
*/
-//@ts-expect-error
-@inline
export function fe_sub (h: FieldElement, f: FieldElement, g: FieldElement): void {
const f_ptr = changetype<usize>(f)
const g_ptr = changetype<usize>(g)
-10913610, 13857413, -15372611, 6949391, 114729, -8787816, -6275908, -3247719, -18696448, -12055116, 0, 0
])
-//@ts-expect-error
-@inline
function ge_cmov8_base (t: ge_precomp, bp: usize, b: i8): void {
const isbneg: i8 = (b >> 7) & 1 /* 0: positive; 1: negative */
const babs: i8 = b - (((-isbneg) & b) * (i8(1) << 1))
xy2d: FieldElement = fe()
}
-//@ts-expect-error
-@inline
export function ge_p2_0 (h: ge_p2): void {
fe_0(h.X)
fe_1(h.Y)
fe_1(h.Z)
}
-//@ts-expect-error
-@inline
export function ge_p1p1_0 (h: ge_p1p1): void {
fe_0(h.X)
fe_1(h.Y)
fe_0(h.T)
}
-//@ts-expect-error
-@inline
export function ge_p3_0 (h: ge_p3): void {
fe_0(h.X)
fe_1(h.Y)
fe_0(h.T)
}
-//@ts-expect-error
-@inline
export function ge_precomp_0 (h: ge_precomp): void {
fe_1(h.yplusx)
fe_1(h.yminusx)
/**
* r = p
*/
-//@ts-expect-error
-@inline
export function ge_p2_to_p3 (r: ge_p3, p: ge_p2): void {
fe_copy(r.X, p.X)
fe_copy(r.Y, p.Y)
/**
* r = p
*/
-//@ts-expect-error
-@inline
export function ge_p1p1_to_p2 (r: ge_p2, p: ge_p1p1): void {
fe_mul(r.X, p.X, p.T)
fe_mul(r.Y, p.Y, p.Z)
fe_mul(r.Z, p.Z, p.T)
}
-//@ts-expect-error
-@inline
export function ge_p1p1_to_p3 (r: ge_p3, p: ge_p1p1): void {
fe_mul(r.X, p.X, p.T)
fe_mul(r.Y, p.Y, p.Z)
/**
* r = p
*/
-//@ts-expect-error
-@inline
export function ge_p3_to_cached (r: ge_cached, p: ge_p3): void {
fe_add(r.YplusX, p.Y, p.X)
fe_sub(r.YminusX, p.Y, p.X)
/**
* r = 2 * p
*/
-//@ts-expect-error
-@inline
export function ge_p2_dbl (r: ge_p1p1, p: ge_p2): void {
const t = ge_p2_dbl_t
fe_sq(r.X, p.X)
* `p.Z` is doubled and stored to itself because its value is not referenced
* again before being reassigned at all three call sites of this function.
*/
-//@ts-expect-error
-@inline
export function ge_add_precomp (r: ge_p1p1, p: ge_p3, q: ge_precomp): void {
fe_add(r.X, p.Y, p.X)
fe_sub(r.Y, p.Y, p.X)
const ge_sub_p3_q_cached = new ge_cached()
const ge_sub_p3_p1p1 = new ge_p1p1()
/* r = p-q */
-//@ts-expect-error
-@inline
export function ge_sub_p3 (r: ge_p3, p: ge_p3, q: ge_p3): void {
const q_cached = ge_sub_p3_q_cached
const p1p1 = ge_sub_p3_p1p1
* performance.
* @param k 32-byte scalar
*/
-//@ts-expect-error
-@inline
export function clamp (k: StaticArray<u8>): void {
k[0] &= 248
k[31] &= 127
* @param {i32} n
* @returns 1 if `n` bytes are equal, else 0
*/
-//@ts-expect-error
-@inline
export function equalbytes (f: StaticArray<u8>, g: StaticArray<u8>, n: i32): u8 {
let b: i32 = 0
for (let i = 0; i < n; i++) {
return u8(((b - 1) >> 8) & 1)
}
-//@ts-expect-error
-@inline
export function load_3 (input: StaticArray<u8>, i: u8): u64 {
let result: u64 = u64(input[i])
result |= u64(input[i + 1]) << 8
return result
}
-//@ts-expect-error
-@inline
export function load_4 (input: StaticArray<u8>, i: u8): u64 {
let result: u64 = load_3(input, i)
result |= u64(input[i + 3]) << 24
return result
}
-//@ts-expect-error
-@inline
export function sodium_is_zero (n: StaticArray<u8>, nlen: i32): u8 {
let d: i32 = 0
for (let i: i32 = 0; i < nlen; i++) {