Skip to content

Conversation

@godcong
Copy link
Contributor

@godcong godcong commented Apr 1, 2025

No description provided.

godcong added 11 commits March 28, 2025 20:28
…nterface

- Remove unused algorithms: SHA1, SHA256, dummy
- Add Type() method to Cryptographic interface
- Implement Type() method for all existing algorithms
- Update crypto struct to use algorithm type as key
- Add default cost parameter and salt
- Include ScryptConfig with default N, R, and P values
- Update comments to reflect new default settings
- Replace generic error messages with specific error types for algorithm mismatch and password not match
- Add support for SHA-1 and SHA-256 hashing algorithms
- Implement constant-time comparison for SHA-256 to enhance security
- Update existing algorithms (Argon2, Bcrypt, HMAC256, MD5) to use specific error types
- Add support for SHA-512 hashing
- Update SHA-1 and SHA-256 implementations
- Remove dummy crypto implementation
- Update cached crypto to use type from wrapped crypto
- Deleted the entire sha1 and sha256 algorithm implementations
- Removed associated files and imports
- Implement PBKDF2 hashing algorithm in the crypto toolkit
- Add new configuration options for PBKDF2: iterations and hash type
- Update crypto factory to support PBKDF2
- Include PBKDF2 in the list of available hashing algorithms
- Add core/hash package to support custom hash functions
- Implement hash.Hash interface for various algorithms including MD4, MD5, SHA1, SHA256, etc.
- Provide registration mechanism for custom hash functions
- Include test cases for supported hash algorithms
…unctionality

- Add RegisterOrUpdateHashFunc to register or update hash functions
- Implement IsCustomHash function to check if a hash is custom
- Update test cases to include custom hash functions and edge cases
- Improve error handling and test coverage for hash parsing and custom hash scenarios
- Add ParamConfig interface and implement for each hash algorithm
- Update Config struct to use ParamConfig instead of individual fields
- Modify validation and creation logic to use new param config
- Update examples and tests to use new param config format
- Remove direct usage of crypto/sha packages
- Use core.Hash interface instead of hash.Hash
- Implement hash algorithm initialization using core.ParseHash
- Make hash algorithm name case-insensitive
- Update hash core to support lowercase algorithm names
- Replace simple equality check with constant-time comparison for password hashes
- Use crypto/subtle package to prevent timing attacks
- Affected algorithms: hmac256, pbkdf2, sha
@godcong godcong merged commit 93ce60b into origadmin:main Apr 1, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant