Contractless-PHP-Modules/interop
viraladmin 40bdc3dd79 Initial Contractless PHP crypto modules 2026-07-25 13:07:35 -06:00
..
src Initial Contractless PHP crypto modules 2026-07-25 13:07:35 -06:00
Cargo.lock Initial Contractless PHP crypto modules 2026-07-25 13:07:35 -06:00
Cargo.toml Initial Contractless PHP crypto modules 2026-07-25 13:07:35 -06:00
README.md Initial Contractless PHP crypto modules 2026-07-25 13:07:35 -06:00
oqs_interop.c Initial Contractless PHP crypto modules 2026-07-25 13:07:35 -06:00
skein_interop.c Initial Contractless PHP crypto modules 2026-07-25 13:07:35 -06:00

README.md

Contractless PHP Crypto Interoperability

This harness verifies that the native libraries packaged by contractless-php-crypto produce data compatible with Contractless.

Results

  • The C implementation wrapped by jedisct1/PHP-Skein-Hash produces the same 32-byte Skein-256 output as the Rust skein crate used by Contractless.
  • Unmodified Falcon-padded-512 message handling is not compatible with Contractless fn-dsa 0.3.0.
  • Falcon-padded-512 keys and fixed signatures use the same Contractless sizes: 897-byte public keys, 1,281-byte private keys, and 666-byte signatures.
  • Both signing implementations are compatible when liboqs receives the message framing used by Contractless:
SHAKE256(public_key, 64 bytes) || 0x00 || 0x00 || original_message

The two zero bytes represent raw-message mode and an empty domain context.

With that adapter:

  • Contractless Rust signatures verify through liboqs.
  • Liboqs signatures verify through Contractless Rust.

Required liboqs algorithm

Use Falcon-padded-512. Do not use variable-length Falcon-512.

Regression requirement

Run these tests whenever Contractless changes its fn-dsa, skein, or signature-framing dependencies. Matching key and signature lengths alone does not establish compatibility.