- New docs/LegacyDigest.md: full reference for lyng.legacy_digest,
covering the sha1() API, input types (String / Buffer), FIPS compliance
note, and explicit guidance on appropriate vs. inappropriate use.
- docs/ai_stdlib_reference.md: entry in section 5 so AI agents know
LegacyDigest.sha1() exists and is intentionally named as legacy-only.
- docs/whats_new.md: release-note section alongside Complex, Decimal,
and Matrix, with a minimal runnable example and cross-link.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Provides a pure Kotlin/KMP SHA-1 implementation with no extra dependencies,
exposed as `LegacyDigest.sha1(data)` in the `lyng.legacy_digest` package.
The naming deliberately signals that SHA-1 is cryptographically broken:
the object name `LegacyDigest` and prominent doc-comment warnings steer
users away from security-sensitive use while still enabling interoperability
with legacy protocols and file formats that require SHA-1.
API:
import lyng.legacy_digest
val hex: String = LegacyDigest.sha1("some string") // UTF-8 input
val hex: String = LegacyDigest.sha1(someBuffer) // raw-byte input
Tests cover FIPS 180-4 known-answer vectors (empty, "abc", long message,
quick-brown-fox) at both the Kotlin and Lyng integration levels.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When createField() was called with a pre-assigned methodId, the ID was
used but methodIdMap was not updated and nextMethodId was not advanced.
This caused assignMethodId() for static methods to reuse slot IDs
already occupied by instance methods.
In complex.lyng, fromInt/imaginary got IDs 12/14 (same as plus/mul),
causing binary operator dispatch via CALL_MEMBER_SLOT to call the wrong
function (e.g. a*b would invoke imaginary instead of mul).
Fix: after computing effectiveMethodId in createField, always register
it in methodIdMap and advance nextMethodId past it so subsequent
auto-assignments start from a clean range.
Also pre-assigns method IDs for non-static fun/fn declarations during
class body pre-scan so forward references resolve correctly in class
bodies, and adds ComplexModuleTest coverage for operator slot dispatch.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>