Initial release: Go Jdenticon library v0.1.0

- Core library with SVG and PNG generation
- CLI tool with generate and batch commands
- Cross-platform path handling for Windows compatibility
- Comprehensive test suite with integration tests
This commit is contained in:
Kevin McIntyre
2026-01-02 23:56:48 -05:00
parent f84b511895
commit d9e84812ff
292 changed files with 19725 additions and 38884 deletions

View File

@@ -0,0 +1,22 @@
package constants
// Default security limits for DoS protection.
// These constants define safe default values for user inputs to prevent
// denial of service attacks through resource exhaustion while remaining configurable.
// DefaultMaxIconSize is the default maximum dimension (width or height) for a generated icon.
// A 4096x4096 RGBA image requires ~64MB of memory, which is generous for legitimate
// use while preventing unbounded memory allocation attacks.
// This limit is stricter than the JavaScript reference implementation for enhanced security.
const DefaultMaxIconSize = 4096
// DefaultMaxInputLength is the default maximum number of bytes for the input string to be hashed.
// 1MB is sufficient for any reasonable identifier and prevents hash computation DoS attacks.
// Input strings longer than this are rejected before hashing begins.
const DefaultMaxInputLength = 1 * 1024 * 1024 // 1 MB
// DefaultMaxComplexity is the default maximum geometric complexity score for an identicon.
// This score is calculated as the sum of complexity points for all shapes in an identicon.
// A complexity score of 100 allows for diverse identicons while preventing resource exhaustion.
// This value may be adjusted based on empirical analysis of typical identicon complexity.
const DefaultMaxComplexity = 100