@SIGN

Windows ✓Linux ✓macOS ⏳

[VDS7]

Syntax

@SIGN(<data>, <private seed>)

@SIGN(, <private seed>, PUB)

Description

This function creates an Ed25519 digital signature. It is the counterpart of @VERIFY: a signature made with @SIGN can be checked by any program that holds the matching public key, and cannot be forged without the private seed.

@SIGN(<data>, <private seed>) Returns the detached signature of the bytes of <data>, as 128 hexadecimal characters (64 bytes).
@SIGN(, <private seed>, PUB) Returns the public key that corresponds to <private seed>, as 64 hexadecimal characters (32 bytes). The first parameter is ignored.

<private seed> is the private key in its seed form: 32 bytes written as 64 hexadecimal characters (upper or lower case). The results are returned in lower case.

If the seed is malformed (wrong length, or characters that are not hexadecimal) the function returns an empty string. It never raises a run-time error.

No key is built into the language: each program brings its own. Signing the same data with the same seed always gives the same signature.

Keep the private seed secret. It belongs on the publisher's side only — in the tool that issues licenses or signs files — and must never be included in a program that is distributed. A distributed program needs only the public key, and @VERIFY. The seed should be 32 bytes produced by a cryptographically secure random generator.

OK

Unchanged.

Example

REM publisher side: the seed is private
%%seed = 4ccd089b28ff96da9db6c346ec114e0f5b8a319f35aba624da8cf6ed4fb8a6fb
REM the public key to embed in the distributed program
%%pub = @sign(,%%seed,PUB)
REM sign a piece of data
%%msg = John Smith|2026-11-12
%%sig = @sign(%%msg,%%seed)
if @verify(%%msg,%%sig,%%pub)
  info Signature is valid
end

See also