Change Log
v1.3.0 (2026-10-19)
✨ Features
- Add ASN.1 ciphertext and signature formats to SM2:
Sm2CipherModegainsASN1C1C2C3andASN1C1C3C2, so ciphertext can be encoded as the DERSEQUENCE { x INTEGER, y INTEGER, C2 OCTET STRING, C3 OCTET STRING }that BouncyCastle, Java and most national-crypto gateways produce, instead of only the rawC1 || C2 || C3/C1 || C3 || C2byte layout;Sm2SingMode(ASN1as the default,Bytes) andSetSingModeare added so a signature is either a DERSEQUENCE { r, s }or a fixed 64-byter || s; both formats are parsed withcryptobyte, so a truncated or non-DER payload returns an error instead of being silently misread, andNewSm2KeyPairkeepsASN1as the default (by @Web-Coke in #40) - Extend the morse alphabet to the full ITU-R M.1677-1 table and the international extended characters: adds
¡,¿,å/Å,ä/Ä,é/É,ñ/Ñ,ó/Ó,ö/Öandú/Úwith the codes published by codigomorse.org, documents which ITU section each group comes from, and moves/into the punctuation group; note that two existing mappings change —<moves from.--.-to.--.--because.--.-now belongs toå, and\nbecomes.-..-.., which also separates it from\r; text encoded with v1.2.3 decodes differently for those two characters (by @htlsmilework in #42)
🐛 Fixes
- Fix ascii85 decoding truncating its output when
zshortcuts are present:encoding/ascii85emits a singlezfor an all-zero four-byte group and the encoder here does the same, but the decoder recomputed the destination length from the character count at a strict 5:4 ratio and truncated the standard library's correct answer to it, so five zero bytes round-tripped to two, and eight zero bytes to one, without any error;zis now excluded from the ratio and counted as four bytes, and the destination is sized for the expansion a shortcut implies (by @youdie006 in #44) - Fix ascii85 decoding failing for four or more zero groups: the
upadding still usedlen(src)%5after the length fix above, so withzshortcuts present the final group could be left with a single character, whichencoding/ascii85rejects — sixteen zero bytes, encoded aszzzz, did not decode at all; both decoders now pad by the non-zlength (by @youdie006 in #47) - Fix base58 and base62 streams producing different output from the bulk API: both alphabets treat the input as a single big number, so it cannot be split into independent chunks, yet the stream encoder encoded every 8 bytes separately and the stream decoder decoded every 1024 bytes separately —
Encode.FromFile(...).ByBase58()andByBase62()returned a different result thanFromBytes()for the same data, and that result did not decode back; the stream encoder now buffers the input and encodes it once inClose, as its documentation already described, and the decoder reads all of the encoded input and decodes it once, releasing its buffers as the decoded data is consumed (by @Shaisolaris in #48) - Fix key pairs rejecting keys generated by other tools and panicking on a key of the wrong algorithm: a key was only accepted when it was byte for byte the output of
GenKeyPair, i.e. aPUBLIC KEY/PRIVATE KEYPEM block holding PKIX or PKCS#8 DER; the base64 and raw material printed by most SM2 and Ed25519 generators failed withinvalid public key: <nil>or an unintelligible ASN.1 error, and an RSA key passed to an Ed25519 key pair panicked because the result of the type assertion was never checked (#41); everyParse*,Format*andSet*method now goes through a shared selector that tries the input as PEM, base64 (all four alphabets, with or without padding), hex and bare key material, and lets the algorithm-specific parser pick the interpretation that works — Ed25519 accepts PKIX/PKCS#8 DER, a 32-byte seed and a 64-byte private key, SM2 accepts PKIX/PKCS#8 DER, a 65-byte uncompressed point and a 32-byte scalar, RSA accepts PKIX/PKCS#1 DER; SM2 key formatting now uses a local SPKI/PKCS#8 encoder becausecrypto/x509has no SM2 support, so the output still parses in OpenSSL and Java;Set*Keyaccept PEM and normalize it, a block of another algorithm or direction is rejected before parsing withUnsupportedKeyFormatError("the parsed key is an RSA key, not an Ed25519 key"), the error messages no longer print<nil>,Compress*Keyusepem.Decodeinstead of string surgery so optional headers are handled, and the SM2 private scalar is validated to be in[1, n-1]—d = 0used to produce a key without a public point (by @gouguolei in 012269d)
⚡ Performance
- Derive the morse reverse alphabet once instead of scanning it per symbol:
StdDecoder.Decoderanged over the wholeStdAlphabetuntil it found a matching code, making decoding O(n × 89) where it should be O(n) and spending 53% of a CPU profile in map iteration; the inverse map is now built once ininit(), the way base45 and base91 already derive their decode tables, cutting the geomean by 89.21% (4096 characters: 1222µs → 103µs) with allocations unchanged; the scan also made decoding non-deterministic, because seven codes are shared by an upper- and lower-case pair (Å/åfor.--.-, and likewise forä,é,ñ,ó,ö,ú) and ranging over a map picks a random winner, so.--.-decoded toÅ62% of the time and encoding-then-decoding those characters was not lossless; the inverse map resolves such collisions to the lower-case form, which is the only oneEncodecan produce (by @darakanoit in #46)
🔧 Refactors
- Route key serialization through package-level helpers:
marshalPKIXPublicKeyandmarshalPKCS8PrivateKeyare now variables wrappingcrypto/x509, andmarshalSm2PublicKey/marshalSm2PrivateKeywrap the local SM2 encoder, so the error branches ofFormat*Keycan be simulated in tests, sincecrypto/x509never fails for a key that has already been parsed into its typed form; RSA, Ed25519 and SM2 formatting all use them (by @gouguolei in e314c99 6ad47b4 0769ea0 2c9ad5a) - Simplify the RSA stream verifier and drop unused stream buffers:
rsa.StreamVerifier.verifyreturns only anerrorinstead of avalidflag that was always true when the error was nil,unicode.StreamEncoderandunicode.StreamDecoderlose their unused fixed[512]bytebuffers, and the morse error message uses a plain string literal instead offmt.Sprintfwith no verbs (by @gouguolei in 68dad92) - Fix an inverted
SetSingModeassertion and initialize the SM2 default explicitly: the clamp test expectedSingModeto stayASN1afterSetSingMode(Bytes), which cannot happen because the setter simply assigns, andNewSm2KeyPairrelied on the zero value beingASN1; the constructor now setsSingMode: ASN1and the test asserts both directions (by @gouguolei in 079efab) - Clean up and extend the test suite: removes unused variables and duplicated cases from 24 test files, adds
key_format_test.goandkey_test.gocovering the key material helpers, everyUnsupportedKeyFormatErrormessage and the rejection paths of the public API, and covers the SM2 DER and private scalar range branches, raisingkeypairstatement coverage to 97.7% (by @gouguolei in 372209d 12c3e11)
🚀 CI
- Add a golangci-lint workflow and configuration:
lint.ymlrunsgolangci-lint-action@v9pinned tov2.15.0on pushes and pull requests to master withcontents: read;.golangci.ymlenables the standard set plusmisspell,unconvert,unparamandwhitespace, disables the opinionatedstaticcheckstyle checks (ST1000–ST1022,QF1001) and excludes(io.Seeker).Seekfromerrcheckbecause rewinding a stream is best-effort by design; the READMEs drop the Go Report Card badge in favour of the workflow status badge (by @gouguolei in 1487675 0517244)
📝 Docs
- Serve the README images from the repository instead of the docs site: the logo, the GVP and G-Star banners and the JetBrains logo now point at
assets/, so the English, Chinese and Japanese READMEs no longer depend ondongle.go-pkg.com(by @gouguolei in 19bffd5)
What's Changed (19)
- add ASN.1 support by @Web-Coke in #40
- fix(morse): Add some code from codigomorse.org and correct some repetitive code by @htlsmilework in #42
- Decode the ascii85 z shortcut without truncating by @youdie006 in #44
- perf(morse): Derive the reverse alphabet once instead of scanning it per symbol by @darakanoit in #46
- Pad the ascii85 partial group without counting z shortcuts by @youdie006 in #47
- fix(coding): encode and decode base58 and base62 streams as a whole by @Shaisolaris in #48
- fix(keypair): correct SingMode test assertion and add explicit default by @gouguolei in 079efab
- fix(keypair): accept externally generated keys instead of panicking by @gouguolei in 012269d
- test(keypair): cover error paths and key material helpers by @gouguolei in 12c3e11
- docs(readme): replace old badge with golangci-lint by @gouguolei in 0517244
- docs(readme): replace old badge with golangci-lint by @gouguolei in 1487675
- test: Clean up redundant content and unused variables in the test code by @gouguolei in 372209d
- test(sm2): DER encoding error branch covering key formatting by @gouguolei in 6ad47b4
- refactor(keypair): Extract x509 Marshall function as a variable to support testing simulation by @gouguolei in e314c99
- refactor(crypto): Replace the ed25519 key serialization function with a local implementation by @gouguolei in 0769ea0
- refactor(rsa): Replace the standard library key serialization function with a custom implementation by @gouguolei in 2c9ad5a
- refactor(crypto/rsa): Simplify function signatures and clean up redundant code by @gouguolei in 68dad92
- docs(readme): Replace the golangci lit badge with the GitHub Actions status badge by @gouguolei in e6f8039
- docs(readme): Replace the image resource reference from remote URL to local assets path by @gouguolei in 19bffd5
v1.2.3 (2025-12-16)
✨ Features
- Let an RSA key pair hold only the key its operation needs:
RsaKeyPairgains aTypefield, set throughSetType, together with the newKeyTypetype and itsPublicKey/PrivateKeyconstants;NewStdEncrypter,NewStdDecrypter,NewStdSigner,NewStdVerifierand their streaming counterparts branch on it, so a key pair carrying only a public key can encrypt and verify and one carrying only a private key can decrypt and sign, and the public key can also be the signing side when a private key is the verifier; an emptyTypefalls back to the sensible side per operation —PublicKeyfor encrypt and verify,PrivateKeyfor decrypt and sign — and the default padding follows the key format,PKCS1keys usingPKCS1v15andPKCS8keys usingOAEPfor encryption andPSSfor signing, withOAEPrejected for signing andPSSfor encryption throughUnsupportedPaddingSchemeError; the padding for both key sides and every combination is now implemented incrypto/internal/rsa, including the PSS encoding and MGF1 that Go'scrypto/rsaonly exposes for one direction (by @gouguoyin in 12ffe48 eb81cbc 33ac684 749b690) - Add
SetModetoSm2KeyPairand renameCipherOrdertoSm2CipherMode:SetModebecomes the documented way to pick the ciphertext order andSetOrderis kept as a thin alias so existing calls still compile; the type rename only breaks code that spelledCipherOrderout, and theorderparameter is renamed tomodethroughout so it no longer collides with the word used for key ordering (by @gouguoyin in 858d8b8 3785a02 6d30805 56b6b15)
🔧 Refactors
- Remove
LoadPublicKeyandLoadPrivateKeyfromSm2KeyPair: SM2 was the last key pair that read files itself, so a caller had to hand it anfs.File; read the file and pass the bytes toSetPublicKey/SetPrivateKeyinstead, the way RSA and Ed25519 already work (by @gouguoyin in e4d6e3c) - Split
crypto/sm2intoencrypt.go,decrypt.go,sign.goandverify.goand rename the internal helpers toEncryptWithPublicKey,DecryptWithPrivateKey,SignWithPrivateKeyandVerifyWithPublicKey, so the direction each function needs is visible at the call site; the redundant SM2 implementation is deleted, the auxiliary functions move to their own files, and theprivfield is renamed toprito match the rest of the package (by @gouguoyin in 86819de 1602745 0dfd8ea c0a45e4 ccc968f f876923) - Cache the parsed Ed25519 keys: the signer and verifier used to parse the PEM on every call and duplicated the parsing logic that lives in
crypto/keypair; both now cache the parsed key once, the duplicate code is gone, and the package is split intoed25519.go,sign.goandverify.go(by @gouguoyin in 0ed7ca5) - Delete the redundant cipher creation in the RC4 fallback path: the fallback branch built a cipher that was immediately discarded (by @gouguoyin in 9320875)
What's Changed (18)
- refactor(ed25519): Remove duplicate key parsing logic and use caching to improve performance by @gouguoyin in 0ed7ca5
- refactor(rc4): Delete the redundant code for creating cipher in fallback by @gouguoyin in 9320875
- chore(sm2): Remove redundant implementation and modularize the splitting function to independent files by @gouguoyin in 86819de
- refactor(sm2): priv -> pri by @gouguoyin in f876923
- feat(rsa): Provide signature generation and verification methods based on public and private keys by @gouguoyin in 749b690
- feat(keypair): Add key type definition to distinguish between public and private keys by @gouguoyin in 12ffe48
- feat(rsa): Add a Type field in the RsaKeyPair structure to specify the key type by @gouguoyin in eb81cbc
- feat(rsa): Add support for public key encryption and private key decryption by @gouguoyin in 33ac684
- refactor(sm2): Remove the CipherOrder type definition and replace it with a string constant by @gouguoyin in 3785a02
- refactor(sm2): Delete the 'LoadPublicKey' and 'LoadPrivateKey' methods by @gouguoyin in e4d6e3c
- refactor(sm2): Decrypt -> DecryptWithPrivateKey by @gouguoyin in 1602745
- refactor(sm2): Encrypt -> EncryptWithPublicKey by @gouguoyin in 0dfd8ea
- refactor(sm2): Sign -> SignWithPrivateKey by @gouguoyin in c0a45e4
- refactor(sm2): Verify -> VerifyWithPublicKey by @gouguoyin in ccc968f
- refactor(sm2): Change the function parameter name from 'order' to 'mode' by @gouguoyin in 6d30805
- feat(crypto): Add
SetModemethod to replace the existingSetOrdermethod by @gouguoyin in 858d8b8 - refactor(sm2): Rename the Order parameter to Mode by @gouguoyin in 56b6b15
- docs(utils): Update Int2Bytes function comments by @gouguoyin in 3d22896
v1.2.2 (2025-12-08)
✨ Features
- Add SM2 signing and verification to the fluent API:
Signer.BySm2andVerifier.BySm2are added for both standard and streaming processing, so SM2 joins RSA and Ed25519 and a signature can be produced with the private key and checked with the public key in the same chain;Sm2KeyPair.SetUIDsets the user identity mixed into ZA, which stays1234567812345678when unset; verification reports an empty signature asEmptySignatureErrorbefore any curve arithmetic happens (by @gouguoyin in b72066e 0382cd6 39d00c3) - Add RSA padding scheme selection: the new
RsaPaddingSchemetype exposesPKCS1v15,OAEPandPSS, chosen withSetPadding;PKCS1v15works for both encryption and signing,OAEPonly for encryption and requires a hash set throughSetHash,PSSonly for signing; when no padding is set it follows the key format,PKCS1keys falling back toPKCS1v15andPKCS8keys toOAEP, and an unsupported combination returnsUnsupportedPaddingSchemeErrorinstead of an opaque standard-library error (by @gouguoyin in d1734dc b4173be d08e5fc) - Add separate key and signature error types:
EmptyPrivateKeyError,EmptyFormatError,UnsupportedKeyFormatError,EmptyPaddingError,UnsupportedPaddingSchemeErrorandEmptySignatureErrorreplace the single catch-all, so a missing key can be told apart from a malformed one (by @gouguoyin in 856dd51)
🐛 Fixes
- Fix RSA decryption failing for PKCS#1 v1.5 ciphertext when the private key is stored as PKCS#8 (#39): with
Formatset toPKCS8and no explicit padding, decryption fell back to OAEP, so data encrypted by JSEncrypt or by PHP'sopenssl_*defaults failed withcrypto/rsa: decryption erroreven though PHP itself decrypted it; the padding is now selectable throughSetPaddingand the key pair from the report is kept as a regression test (by @gouguoyin in 27c69f6) - Remove the redundant signature length check from RSA verification: the guard rejected signatures produced by other libraries before
rsa.Verify*had a chance to validate them, while the standard library already reports a clear error for a malformed length (by @gouguoyin in faa99bb)
⚡ Performance
- Avoid one copy when morse encoding and decoding return their result:
[]byte(builder.String())is replaced withutils.String2Bytes, which reuses the builder's buffer instead of copying it once more, which matters for large payloads where the output is already the dominant allocation (by @gouguoyin in 10d2eb0)
🔧 Refactors
- Rename the key format and cipher order types per algorithm:
KeyFormatbecomesRsaKeyFormatandCipherOrderbecomesSm2CipherOrder, so neither carries a generic name that reads as if it applied to every algorithm;NoSignatureErrorbecomesEmptySignatureError,UnsupportedPemTypeErrorbecomesUnsupportedKeyFormatErrorandEd25519KeyPair.SignbecomesSignature(by @gouguoyin in 37d5a1a ac77cf7 6135756 8a6ea39) - Rewrite the RSA encrypt, decrypt, sign and verify paths: each operation now resolves its padding once when the encrypter, decrypter, signer or verifier is created and dispatches on it, so a
PSSrequest reaching the encryption path or a missing hash for OAEP is reported up front instead of failing mid-stream (by @gouguoyin in d08e5fc) - Rename the streaming decryptor fields from
decryptedtobufferand frompostopositionacross 3DES, AES, Blowfish, DES, Tea, XTea, Twofish, SM4 and Salsa20, and simplify how the 3DES streaming decryptor slices its input (by @gouguoyin in 114d3be efefe59 e66e508 ba303e7 4d93579 e0b9f3b 5f311b4 426506a f375496 ce101f1) - Hold the Ed25519 key pair by value in
StdSignerandStdVerifierinstead of by pointer, so a key pair mutated after construction cannot change an operation that is already running, and simplify the Ed25519 error types (by @gouguoyin in b5cd502 225b70f) - Move
mockandutilsintointernal: the test helper and the zero-copy helpers are no longer importable from outside the module, and the SM4 implementation moves intocrypto/internal/sm4(by @gouguoyin in ef82486 fe841a7) - Rename the internal
sm2curvepackage tosm2and align thestdAsn1alias with theencodingAsn1naming used elsewhere (by @gouguoyin in 14e9818 cf69603) - Simplify the tests:
mock.Filefrominternal/mockreplaces the per-test reader mocks, every test closes the files it opens, and the Chinese comments are translated to English (by @gouguoyin in 6b021d7 3ea3710 bd8b1b3 7fb2ddc 9a4b693 2cab5e7 bbc4123 ee77460)
📝 Docs
- Update the key pair package documentation and the RSA usage instructions to cover the new padding and key format types (by @gouguoyin in dafc7cf b765056 399de93)
What's Changed (38)
- refactor(sm2curve): ParseDerPublicKey -> ParseBitStringPublicKey, ParseDerPrivateKey -> ParseBitStringPrivateKey by @gouguoyin in faac61c 81224c4
- refactor(internal): Move
mockandutilspackages tointernalby @gouguoyin in ef82486 - refactor(sm2curve): stdAsn1 -> encodingAsn1 by @gouguoyin in cf69603
- docs: Remove document comments for package by @gouguoyin in 43a793b
- test(coding): Change Chinese annotations to English by @gouguoyin in ee77460
- refactor(crypto/3des): Optimize the data processing logic of the streaming decryptor by @gouguoyin in ce101f1
- refactor: decrypted -> buffer, pos -> position in AES, Blowfish, DES, Tea, XTea, Twofish, SM4 and Salsa20 by @gouguoyin in 114d3be efefe59 e66e508 ba303e7 4d93579 e0b9f3b 5f311b4 426506a f375496
- refactor(ed25519): Modify the keypair field in StdSigner and StdVerifier to a value type instead of a pointer type by @gouguoyin in b5cd502
- refactor(ed25519): Simplify error types and optimize error message formats by @gouguoyin in 225b70f
- chore(crypto): NoSignatureError -> EmptySignatureError by @gouguoyin in 6135756
- fix(rsa): Remove redundant signature length check by @gouguoyin in faa99bb
- fix(rsa): Fix PKCS8 format key decryption failure (issue #39) by @gouguoyin in 27c69f6
- refactor(crypto): Sign -> Signature, UnsupportedPemTypeError -> UnsupportedKeyFormatError by @gouguoyin in 8a6ea39
- feat(crypto): Add multiple types of key and signature related errors by @gouguoyin in 856dd51
- feat(crypto): Introduce PaddingScheme type to support multiple RSA filling schemes by @gouguoyin in d1734dc
- feat(rsa): Add the SetPadding method by @gouguoyin in b4173be
- refactor(rsa): Refactoring RSA encryption, decryption, signature verification logic by @gouguoyin in d08e5fc
- feat(sm2curve): Implement SM2 algorithm signature and verification function by @gouguoyin in 0382cd6
- feat(sm2): Add SetUID method by @gouguoyin in 39d00c3
- refactor(crypto/sm2): Remove unused error types by @gouguoyin in 7bc33cd
- feat(crypto): Add SM2 signature and verification function by @gouguoyin in b72066e
- refactor(sm2): Remove redundant auxiliary functions and dependencies by @gouguoyin in bc5962c
- docs(keypair): Update the documentation for the key pair package by @gouguoyin in dafc7cf
- chore(rsa): Move the RSA key format and padding scheme type to the
rsa.gofile by @gouguoyin in 88ba1d6 - chore(sm2): Move the SM2 cipher order from
keypair.gotosm2.gofile by @gouguoyin in ac77cf7 - chore(test): KeyFormat -> RsaKeyFormat by @gouguoyin in 37d5a1a
- refactor(sm2): Rename the sm2curve package to sm2 and update related references by @gouguoyin in 14e9818
- refactor: Modify the cipher field type of the encryption and decryption structures in 3DES, AES, Blowfish, ChaCha20, ChaCha20-Poly1305, DES, Salsa20, Tea, XTea, Twofish and SM4 by @gouguoyin in d7d72be af560ef 582d5d8 38587f9 5b780d4 4c87f81 b0f2e45 ec29312 8435966 1b2be97 ab4ee6d
- test(sm2): []byte{} -> {} by @gouguoyin in 48834cc
- refactor(sm4): Migration of SM4 implementation from crypto/sm4/core.go to crypto/internal/sm4/sm4.go by @gouguoyin in fe841a7
- refactor(morse): Optimize the conversion method from string to byte slice by @gouguoyin in 10d2eb0
- test(coding): Simplify code using mock.File by @gouguoyin in 6b021d7
- test(crypto): Simplify code using mock.File by @gouguoyin in 3ea3710
- test(hash): Simplify code using mock.File by @gouguoyin in bd8b1b3
- test(sm2): Simplify code using mock.File by @gouguoyin in 7fb2ddc
- test: Add defer file.Close() to all test functions to avoid resource leakage by @gouguoyin in 9a4b693 2cab5e7 bbc4123
- docs(crypto): Update RSA key pair document comments by @gouguoyin in b765056
- docs(rsa): Update RSA key pair usage instructions by @gouguoyin in 399de93
v1.2.1 (2025-11-24)
✨ Features
- Add direct parsing support for
BIT_STRINGformat keys inSm2asymmetric elliptic curve encryption algorithm
🐛 Fixes
- Fix bug where
wNAFalgorithm error inSm2asymmetric elliptic curve encryption algorithm causes decryption failure in some cases
⚡ Performance
- Optimize curve field element operation implementation in
Sm2asymmetric elliptic curve encryption algorithm
🔧 Refactors
- Simplify test loop syntax, change from
forloop torangeloop
What's Changed (12)
- refactor(sm2curve): pointFelem -> pointField by @gouguoyin in eb6878e
- test(sm2): Change the declaration method of empty byte slices from literal to var declaration by @gouguoyin in 38a86c8
- style(sm2curve): Add necessary comments by @gouguoyin in 27497c7
- Potential fix for code scanning alert no. 1: Workflow does not contain permissions (#33) by kuafuRace in 9bab6c9
- Add direct parsing of hexadecimal key pairs for SM2 (#32) by @WebChang in a4509b6
- Fix the wNAF algorithm (#36) by @WebChang in 73911e8
- fix(crypto): Introduce a rewritable parseDerPrivatKeyFunc variable to support test simulation by @gouguoyin in d61fe04
- test(sm2): Improve unit testing coverage to 100% by @gouguoyin in 7b2ddf3
- chore(version): Update version number to 1.2.1 by @gouguoyin in 31d1ee7
- Add issue unit test (#38) by @WebChang in b91161c
- fix(sm2curve): Fix SM2 curve domain element subtraction and borrowing processing by @gouguoyin in 1164b55
- fix(sm2): Add issue #34 unit test by @gouguoyin in b86b4dd
v1.2.0 (2025-11-11)
✨ Features
RSAKeyPairstruct addsFormatPublicKeyandFormatPrivateKeymethods to formatbase64encodedderformatRSApublic and private keys intopemformatEd25519KeyPairstruct addsFormatPublicKeyandFormatPrivateKeymethods to formatbase64encodedderformatEd25519public and private keys intopemformatRSAKeyPairstruct addsCompressPublicKeyandCompressPrivateKeymethods to compresspemformatRSApublic and private keys intobase64encodedderformatEd25519KeyPairstruct addsCompressPublicKeyandCompressPrivateKeymethods to compresspemformatEd25519public and private keys intobase64encodedderformat- Add
Sm2asymmetric elliptic curve encryption algorithm support, including standard processing and streaming processing
⚡ Performance
- Optimize encoder and decoder performance, reuse read buffer, reduce memory allocation and copying
🔧 Refactors
- Remove
LoadPublicKeyandLoadPrivateKeymethods fromRSAKeyPairstruct - Remove
LoadPublicKeyandLoadPrivateKeymethods fromEd25519KeyPairstruct RSAKeyPairstruct'sGenKeyPair,SetPublicKey,SetPrivateKeymethods changed from no return value to returningerrorEd25519KeyPairstruct'sGenKeyPair,SetPublicKey,SetPrivateKeymethods changed from no return value to returningerror
What's Changed (25)
- chore(dongle): Update package meta and version number by @gouguoyin in ab46cdb
- feat(mock): Add
Error WriteAfterNstruct, which supports returning an error after a specified number of writes by @gouguoyin in a92350f - test(style): Unify unit test case Name by @gouguoyin in fda8e09
- fix(cipher): Change the return value of empty input from
srcto[]byte{}by @gouguoyin in 81d8e29 - feat(sm2curve): Implement SM2-P-256 elliptic curve and ASN.1 encoding and decoding for sm2 by @gouguoyin in 8120c6b
- perf(base32): Optimize the performance of streaming codecs by @gouguoyin in df8bc9f
- perf(base45):Optimize the performance of base45 encoding and decoding by @gouguoyin in 15669d5
- refactor(base58): Optimize the implementation of stream encoders and decoders by @gouguoyin in 70b7b7b
- refactor(base62): Optimize the implementation of stream encoders and decoders by @gouguoyin in 2de952d
- perf(base64): Optimize the implementation of stream encoders and decoders by @gouguoyin in 94575a1
- refactor(base85): Optimize the implementation of stream encoders and decoders by @gouguoyin in 5c03d1a
- perf(base91): Optimize encoding and decoding performance by @gouguoyin in bcff90c
- perf(base100): Optimize the implementation of stream encoders and decoders by @gouguoyin in 058877c
- refactor(morse): Optimize the buffer usage of streaming decoders by @gouguoyin in a52a536
- feat(unicode): Optimize the buffer usage of streaming decoders by @gouguoyin in dd27319
- feat(crypto): Add FormatPublicKey,FormatPrivateKey, CompressPublicKey, CompressPrivateKey methods by @gouguoyin in e947625
- feat(crypto): Add EmptyPublicKeyError and EmptyPrivateKeyError by @gouguoyin in c844db5
- refactor(keypair): Add CipherOrder type to control the order of SM2 ciphertext components by @gouguoyin in e3d8df9
- feat(sm2): Add support for SM2 asymmetric elliptic curve encryption algorithm by @gouguoyin in dfa2a45
- perf(md2): Optimize the performance of MD2 hash algorithm by @gouguoyin in 380718a
- perf(sm3): Optimize the performance of SM3 hash algorithm by @gouguoyin in 9b1e3ed
- docs(readme): Add playground link url by @gouguoyin in c4fac75
- docs: Update the annotation explanation in AES symmetric encryption algorithm by @gouguoyin in 4adf429
- refactor(sm2curve): Refactor the SM2 curve implementation to improve performance and maintainability by @gouguoyin in 10eefe2
- refactor(crypto): MarshalPKCS8 -> MarshalPKCS8PrivateKey, MarshalSPKI ->MarshalSPKIPublicKey by @gouguoyin in ef63d93
v1.1.8 (2025-11-05)
✨ Features
- Add
Unicodeencoding/decoding support, including standard processing and streaming processing - Add
TBCpadding mode support for symmetric block encryption algorithms
🐛 Fixes
- Fix bug where
*RsaKeyPair.formatPublicKeyand*RsaKeyPair.formatPrivateKeyfail to format keys - Fix bug where
*Ed25519KeyPair.formatPublicKeyand*Ed25519KeyPair.formatPrivateKeyfail to format keys - Fix bug where decoding encrypted ciphertext fails during decryption and the error cannot be retrieved
🔧 Refactors
- Change default padding mode from
PKCS7toNoin symmetric block encryption algorithms
What's Changed (36)
- chore(version): Update version number to
1.1.8by @gouguoyin in 3bfd036 - feat(crypto): Add TBC padding mode support by @gouguoyin in 304629d
- feat(unicode): Add
Unicodeencoding and decoding support by @gouguoyin in d174cd8 - ci(test): Add support for Windows testing environment by @gouguoyin in da9ec1e
- fix(hash): Add checks for h.Error by @gouguoyin in c044908
- fix(decoder): Add checks for d.Error by @gouguoyin in 18041a3
- fix(encoder): Add checks for e.Error by @gouguoyin in f97a481
- feat(unicode): Add
Unicodeencoding/decoding support by @gouguoyin in 8e1c38c - feat(crypto): Add custom nonce length support for
GCMmode by @gouguoyin in 5cdaac8 - fix(signer): Add checks for s.Error by @gouguoyin in f0f2bc2
- fix(crypto): Fix signature decoding error handling by @gouguoyin in 4107901
- fix(crypto): Fix ciphertext decoding error handling by @gouguoyin in 763afd8
- refactor(crypto): Change the default padding mode from
PKCS7toNoby @gouguoyin in 00bd32b - feat(crypto/cipher): Optimize the block size check in CBC mode by @gouguoyin in 781f292
- refactor(cipher): Simplify the error handling using switch by @gouguoyin in a0abcf5
- refactor(cipher): InvalidSrcError -> InvalidPlaintextError by @gouguoyin in 2677ffc
- test(des): Remove redundant decryption error test cases by @gouguoyin in 72c39cd
- test(aes): Remove redundant decryption error test cases by @gouguoyin in 36807d5
- test(sm4): Remove padding settings by @gouguoyin in 7cdf2b5
- feat(crypto): Remove padding setting by @gouguoyin in bac1c2a
- fix(xtea): Fix the panic issue in the stream encryption by @gouguoyin in 94596c4
- test(crypto): Update error type assertion by @gouguoyin in 15014ea
- fix(aes): Remove unnecessary comments by @gouguoyin in 37d2aeb
- fix(crypto): Update 3DES decryption error type assertion by @gouguoyin in 1d6ff35
- feat(crypto): Add empty source data check by @gouguoyin in ba919b3
- feat(crypto): Add EmptySrcError type by @gouguoyin in 3dd14a4
- refactor(ed25519): Refactor key formatting method and adding compression method by @gouguoyin in 5be56c1
- refactor(rsa): Refactor RSA key formatting method and adding compression method by @gouguoyin in 7fcd12c
- feat(keypair): Add formatKeyBody function by @gouguoyin in 0893b5d
- refactor(ed25519): Remove non essential comments by @gouguoyin in 734a5f2
- test(ed25519): Add edge testing for
StreamSigner.Writemethod by @gouguoyin in db4dd67 - refactor(crypto): Delete the Error field and instead handle errors through return values by @gouguoyin in b5d9349
- refactor(rsa): Change the return value of the
GenKeyPairmethod from*RsaKeyPairto error by @gouguoyin in e384f4f - chore(crypto): Simplify code by @gouguoyin in 40e077a
- chore(ed25519): Improve key generation and parsing error handling by @gouguoyin in 20893dc
- chore(rsa): Improve key generation and parsing error handling by @gouguoyin in ab5e7a8
v1.1.7 (2025-10-20)
✨ Features
- Add
sm4chinese national standard block encryption algorithm support, including standard processing and streaming processing, supporting different block modes and padding modes
🐛 Fixes
- Fix bug in asymmetric digital signature algorithm verification #30
- Optimize streaming processing logic, add support for
readerposition reset to ensure reading from the beginning of the data source, avoiding position offset issues caused by previous read operations, ensuring completeness and correctness of streaming operations
🔧 Refactors
- Change private methods
newXXXEncrypterandnewXXXDecrypterseries incrypto/cipher/block.goto public methodsNewXXXEncrypterandNewXXXDecrypter - Change private methods
newXXXPaddingandnewXXXUnPaddingseries incrypto/cipher/padding.goto public methodsNewXXXPaddingandNewXXXUnPadding
What's Changed (38)
- chore: Add support for the
io.Seekerinterface to reset the reading position by @gouguoyin in 07a19a9 - refactor(decoder): ff -> f by @gouguoyin in ae38f87
- refactor(test): Unify package import order by @gouguoyin in 36064e0
- docs(github/crypto): Add a period to the note on the encryption method by @gouguoyin in c4af6bd
- feat(crypto): Add support for the SM4 block cipher algorithm by @gouguoyin in 537b615
- chore(crypto/cipher): Remove the comment regarding the default number of rounds in TEA encryption by @gouguoyin in 8b72470
- feat(cipher): Unify function naming convention, newXXX -> NewXXX by @gouguoyin in cff507c
- build(dongle): Update the version number to v1.1.7 by @gouguoyin in 22f0f85
- docs(crypto/cipher): Update the annotation of the padding function by @gouguoyin in f90f6a7
- chore(crypto/cipher): Unify error return variable names and remove redundant comments by @gouguoyin in 6e9db0f
- fix(coding): Optimize the return value when there is an error by @gouguoyin in b581d3b
- chore(crypto): Add initialization error checking by @gouguoyin in 01d6ec7
- test(aes): Delete unnecessary test cases by @gouguoyin in af904d0
- test(des): Delete unnecessary test cases by @gouguoyin in b3f67f6
- test(xtea): Delete unnecessary test cases by @gouguoyin in ba26567
- fix(cipher): Remove duplicate nil block checking logic by @gouguoyin in f13aa33
- chore(crypto/cipher): Add CBC/ECB mode padding processing comments by @gouguoyin in 1205cab
- chore(crypto/cipher): Remove the early return logic when the extra data is empty by @gouguoyin in b66ba65
- test(cipher): Remove duplicate decryption test cases by @gouguoyin in b534394
- test(crypto): Remove test case for invalid cipher by @gouguoyin in d5b5849
- chore(coding): Add comments to Encoder and Decoder structures by @gouguoyin in 57ae7a4
- refactor(crypto):
UnsupportedModeError->UnsupportedBlockModeErrorby @gouguoyin in b6e71b1 - docs(hash): Update package comments by @gouguoyin in 3eb6ce7
- docs(cipher): Add comments by @gouguoyin in 4ec008c
- refactor(cipher): Remove unnecessary return parameters by @gouguoyin in 4e52d83
- fix(cipher): Improve encryption and decryption error handling logic by @gouguoyin in 0d5947a
- feat(crypto): Add UnsupportedBlockModeError and UnsupportedPaddingModeError by @gouguoyin in 2cc0511
- feat(cipher): Optimize zero padding logic by @gouguoyin in cbb4c56
- docs(keypair): Add comments by @gouguoyin in 2122e07
- docs: Update the description of padding mode and hash algorithms in the README by @gouguoyin in 3d0dbb7
- refactor(cipher): Refactor the padding and unpadding methods as receiver methods by @gouguoyin in 3d73c89
- chore(hash): Add comments by @gouguoyin in fe9ba67
- chore(cipher): Unified error return format by @gouguoyin in 063b25c
- fix(rsa): Fix variable reference errors in signature verification logic,
kp.Sign->v.signby @gouguoyin in e78cd47 - test: Add issue #30 unit test cases by @gouguoyin in 2cb142a
- feat(crypto): Add verify status field to enhance signature verification logic by @gouguoyin in c7a76bd
- refactor(utils): []byte("") -> []byte{} by @gouguoyin in 7e378cd
- vm-os: [ubuntu-latest, macos-latest, windows-latest] by kuafuRace in 340283c
v1.1.6 (2025-10-12)
✨ Features
- Optimize
teaencryption algorithm to support different block modes and padding modes - Add
xteaencryption algorithm support, including standard processing and streaming processing
🔧 Refactors
- Use
io.CopyBufferto simplify streaming processing logic
What's Changed (26)
- docs(readme): Update the import path in README.cn.md by @gouguoyin in dbe8da4
- refactor: Rename the
utilpackage toutilsby @gouguoyin in 9c4122e - refactor(cipher): decrypted -> paddedDst by @gouguoyin in 4537c96
- refactor(mock): Unify the naming of receivers in error file simulation by @gouguoyin in def9c0a
- refactor(mock): Move package comment from
file.gotodoc.goby @gouguoyin in 0a86b4a - refactor(utils): Add package comment in
doc.goby @gouguoyin in d625676 - style: Add necessary notes by @gouguoyin in 35ed473
- docs: Add package comments by @gouguoyin in 08ddc95
- chore(encoder):Optimize error handling logic by @gouguoyin in 6b723b5
- chore(coding): Unify the naming of error handling variables and optimize the reading logic by @gouguoyin in 3d16e0f
- chore(crypto): Unify the naming of error handling variables and optimize the reading logic by @gouguoyin in ca35d52
- test: Add test case for issue #28 by @gouguoyin in b87981c
- build: Update version number to
1.1.6by @gouguoyin in 4a16814 - refactor(hash): Use
io.CopyBufferto replace manual reading of the buffer, simplifying the implementation ofstreamandhmacmethods by @gouguoyin in cf399b5 - fix(blowfish): Fix the return value counting logic after encrypted data is written by @gouguoyin in 70ea1f7
- refactor(ed25519): Remove redundant random number generator by @gouguoyin in 6c974f4
- fix(rsa): Optimize RSA key parsing logic and fix return value handling by @gouguoyin in 6ca625c
- feat(crypto): Use
io.CopyBufferto improve the performance and efficiency of stream processing readability and fixing potential read error issues by @gouguoyin in b1d4247 - refactor(decoder):Simplify streaming process with
io.CopyBufferby @gouguoyin in bc1c6ab - refactor(encoder):Simplify streaming process with
io.CopyBufferby @gouguoyin in 730c151 - feat(crypto/tea): Optimize the tea algorithm to support different blocking and padding modes by @gouguoyin in 817e4c5
- feat(crypto/xtea): Add support for
xteaalgorithm by @gouguoyin in 6cc0c01 - test(3des): Remove useless and erroneous tests by @gouguoyin in 2df56d8
- test: Replace the existing custom errorCloser with CloseErrorWriteCloser from the mock library by @gouguoyin in e70157b
- feat(cipher): Update the implementation of the TEA encryption algorithm to support block mode by @gouguoyin in b90d008
- style: Unify the function annotation style and revise some algorithm descriptions by @gouguoyin in 9509d43
v1.1.5 (2025-10-01)
🐛 Fixes
- Fix bug where symmetric encryption algorithms incorrectly perform padding on block modes that don't require padding (such as CFB/OFB/CTR/GCM, etc.), causing encryption/decryption errors
What's Changed (6)
- build(dongle): Updated version number to 1.1.5 by @gouguoyin in 8e1a462
- test(issue): Add issue test file by @gouguoyin in d77ad8c
- refactor(crypto): Unify package grouping import rule by @gouguoyin in 17ff89c
- test(aes): Remove t.Skip test cases by @gouguoyin in 82f450f
- refactor(coding): Unify package grouping import rule by @gouguoyin in 833c1c2
- refactor(cipher): Optimize the logical structure of encryption and decryption #29 by @gouguoyin in a598772
v1.1.4 (2025-09-23)
✨ Features
- Add
twofishencryption algorithm support, including standard processing and streaming processing
🔧 Refactors
- Change method receivers from pointer to value to prevent property pollution when using global default instances, with no impact on caller
API
What's Changed (5)
- build(dongle.go): Update the version number to v1.1.4 by @gouguoyin in 3abadc6
- refactor: Change the receiver of the method from a pointer type to a value type by @gouguoyin in 9b9b104
- docs(chacha20): Add package comments``` by @gouguoyin in 3a66727
- docs(chacha20poly1305): Add package comments by @gouguoyin in 25b9c56
- feat(crypto): Add support for the Twofish encryption algorithm by @gouguoyin in fd78849
v1.1.3 (2025-09-15)
✨ Features
- Update
testifydependency tov1.11.1
🐛 Fixes
- Optimize
3DESsymmetric encryption algorithm compatibility with16-byte keys - Optimize
DESsymmetric encryption algorithm validation for unsupportedGCMmode - Optimize
3DESsymmetric encryption algorithm validation for unsupportedGCMmode - Optimize
Blowfishsymmetric encryption algorithm validation for unsupportedGCMmode
🔧 Refactors
- Add
Salsa20encryption algorithm support, including standard processing and streaming processing
What's Changed (21)
- chore(deps): Update the testify dependency to
v1.11.1by @gouguoyin in 6644d40 - chore: Update dongle to
v1.1.3by @gouguoyin in efa7ffd - perf(hash/md2): []byte{} -> var data []byte by @gouguoyin in e4c4362
- refactor(hash): Unify import package order by @gouguoyin in 57a68fa
- perf(test): []byte{} -> var data []byte by @gouguoyin in f2c7321
- feat(crypto): Add support for the Salsa20 encryption algorithm by @gouguoyin in 8df1550
- fix(crypto/des): Add a error check for unsupported
GCMmode by @gouguoyin in 10c123d - fix(crypto/blowfish): Add an error check for unsupported
GCMmode by @gouguoyin in 7f343cb - fix(crypto/3des): Add an error check for unsupported
GCMmode by @gouguoyin in 6c12f0c - fix(crypto/des): Add an error check for unsupported
GCMmode by @gouguoyin in 895547e - refactor(crypto/aes): Optimize AES encryption and decryption operations by @gouguoyin in 436ae5e
- test(3des): Create alone test files for each block cipher mode by @gouguoyin in ae47981
- test(aes): Create alone test files for each block cipher mode by @gouguoyin in 4c1c349
- test(blowfish): Create alone test files for each block cipher mode by @gouguoyin in 31cfeab
- test(des): Create alone test files for each block cipher mode by @gouguoyin in 171eb70
- fix(crypto/chacha20): Unify import package order by @gouguoyin in d8c9242
- chore(crypto/chacha20loly1305): Unify import package order by @gouguoyin in 718779f
- test(rc4): Modify the test case description by @gouguoyin in f3cad2b
- test(crypto): Unify import package order by @gouguoyin in 8a8361a
- perf(benchmarks): init -> initBenchData by @gouguoyin in 88e5a2f
- feat(crypto): Add documentation comments for the package by @gouguoyin in 9fbddeb
v1.1.2 (2025-09-08)
✨ Features
- Encoding/decoding support customizing file stream buffer size via
coding.BufferSizeglobal variable - Encryption/decryption support customizing file stream buffer size via
crypto.BufferSizeglobal variable - Hash/Hmac algorithms support customizing file stream buffer size via
hash.BufferSizeglobal variable - Add
Blake2bhash algorithm support, includingblake2b-256,blake2b-384andblake2b-512 - Add
Blake2shash algorithm support, includingblake2s-128andblake2s-256 - Add
ChaCha20encryption algorithm support - Add
ChaCha20Poly1305encryption algorithm support
What's Changed (24)
- fix(crypto): Remove redundant code by @gouguoyin in 05ec861
- feat(crypto): Add support for the
ChaCha20encryption algorithm by @gouguoyin in cdff998 - docs: Update usage examples by @gouguoyin in 6710e8f
- refactor(coding): Add BufferSize global variable to define the buffer size for stream processing by @gouguoyin in 2fecf80
- refactor(hash): Add BufferSize global variable to define the buffer size for stream processing by @gouguoyin in 870c557
- refactor(crypto): Add BufferSize global variable to define the buffer size for stream processing by @gouguoyin in 768d89d
- refactor(hash): hash -> hashFunc by @gouguoyin in f68a56c
- refactor(hash): Optimize error messages by @gouguoyin in 1d4d33b
- docs(README): Add digital signature and verification example by @gouguoyin in 762ba1c
- docs: Remove the digital signature and verification example by @gouguoyin in 2eeccf2
- docs(README): Update RSA signature verification example by @gouguoyin in 49e802b
- refactor(hash): Remove the redundant variable totalBytes by @gouguoyin in e14030d
- feat(hash): Add support for the
BLAKE2bhash algorithm by @gouguoyin in 0683cc0 - feat(hash): Add support for the
BLAKE2shash algorithm by @gouguoyin in f5870d7 - test(hash): Unified import of grouping styles by @gouguoyin in 74c2c4a
- test(coding): Unified import of grouping styles by @gouguoyin in 6bb8efd
- test(crypto): Unified import of grouping styles by @gouguoyin in 63e3e81
- test(keypair): Unified import of grouping styles by @gouguoyin in 72be367
- test(cipher): Unified import of grouping styles by @gouguoyin in 6961d3f
- test(cipher): blockCipher.Aad -> blockCipher.AAD by @gouguoyin in 04848cc
- feat(crypto): Add support for
ChaCha20-Poly1305encryption algorithm by @gouguoyin in 8e3b5c3 - docs(README):
hex string->hex-encoded string,base64 string->base64-encoded stringby @gouguoyin in 2c78e49 - docs(README): Use the import block to uniformly import multiple packages by @gouguoyin in 7d8e358
- build: Update the version number to 1.1.2 by @gouguoyin in 80b23e0
v1.1.1 (2025-09-01)
✨ Features
- Encoding/decoding, encryption/decryption, Hash/Hmac, signature/verification support true streaming processing
- Add
ED25519digital signature and verification support - Add
SM3hash algorithm support coding/morse/morse.goadds support for spaces, punctuation, and special characters
⚡ Performance
- When input data is empty, return empty data directly without executing subsequent operations
🔧 Refactors
- Symmetric encryption algorithms changed from
ByXXX(cipher.XXXCipher)toByXXX(*cipher.XXXCipher) - Change toolkit package name from
utilstoutil - Add
mock/hash.goto simulate errors inhash.Hashinterface
What's Changed (42)
- docs(readme): Update RSA encryption and decryption example by @gouguoyin in 4094aac
- refactor: Rename utils package to util by @gouguoyin in 9242991
- feat(hash): Add support for
SM3hash algorithm by @gouguoyin in 3f6e407 - refactor(crypto/3des): Refactor 3DES encryptor and decryptor by @gouguoyin in 4ed070e
- refactor(crypto): Refactor AES encryptor and decryptor by @gouguoyin in 6a3dcf9
- refactor(crypto): Refactor DES encryptor and decryptor by @gouguoyin in 39193c7
- refactor(rc4): Change the parameter type of the ByRc4 method from
cipher.Rc4Cipherto*cipher.Rc4Cipherby @gouguoyin in 4bcba4e - refactor(tea):
cipher.TeaCipher->*cipher.TeaCipherby @gouguoyin in f90f82c - refactor(tea):
cipher.BlowfishCipher->*cipher.BlowfishCipherby @gouguoyin in af4db9d - refactor(crypto/cipher):Rename the
paddingfunction and remove the internaldispatcherby @gouguoyin in e44f321 - feat(crypto): Add the blockCipher struct and encryption/decryption functionality by @gouguoyin in 0c93355
- refactor(crypto/cipher): Change the encryptor and decryptor methods to private by @gouguoyin in 4ab52bd
- refactor(cipher): Refactor the password encoder structure and optimize test cases by @gouguoyin in f904e13
- refactor(mock): data := []byte{} -> var data []byte by @gouguoyin in 40178d8
- refactor: Use
mock.NewFileinstead ofstrings.NewReaderandbytes.NewReaderby @gouguoyin in b77f6c3 - refactor: Use the
errors.Asfunction instead of type assertion by @gouguoyin in c4ddfd0 - feat: Add
FromFilemethod by @gouguoyin in a07314f - refactor: []byte{} -> var []byte by @gouguoyin in 01ebf5e
- test(crypto/cipher): Remove redundant comments by @gouguoyin in e0fb4d0
- test: TestErrorTypes -> TestRsaErrorTypes by @gouguoyin in cd0a48a
- refactor(crypto): triple_des -> tripleDes by @gouguoyin in e3add07
- feat(crypto): Add ED25519 signature and verification methods by @gouguoyin in 39f0ce3
- refactor(crypto): Update variable naming to use camelCase by @gouguoyin in 50d5d4b
- perf(crypto): Remove the error checking for the result of
hasher.Writeby @gouguoyin in 966bdd5 - refactor(mock): Added
mock/hash.goto simulate error conditions of thehash.Hashinterface by @gouguoyin in 4e38f79 - test(coding): Optimize code and add benchmark tests by @gouguoyin in ce64a33
- test(hash): Optimize code and add benchmark tests by @gouguoyin in a30f570
- feat: Implement true streaming encoding and decoding by @gouguoyin in 0fdc666
- feat: Implement true streaming hashing by @gouguoyin in 916d8f3
- refactor(mock): Improve the Sum method of ErrorHasher and add test cases by @gouguoyin in 913ef51
- feat(crypto): Refactor the ED25519 stream signature and verification logic to achieve true stream signature and verification by @gouguoyin in 704bdda
- fix(crypto): Optimize the logic of Close and ReadAll by @gouguoyin in fa1e139
- refactor(crypto): Refactor the Encrypter.stream method to implement true streaming encryption by @gouguoyin in 71ad312
- test(rc4): Optimize the test coverage for RC4 by @gouguoyin in 38b2928
- feat: Implement true streaming encryption and decryption by @gouguoyin in 961dc5d
- build: Update the version number to 1.1.1 by @gouguoyin in a2c746b
- feat(morse): Add support for spaces, punctuation marks, and special characters by @gouguoyin in 017497c
- fix(crypto/3des): Return null data when encrypting or decrypting null data by @gouguoyin in 3145828
- fix(crypto/aes): Return null data when encrypting or decrypting null data by @gouguoyin in f19243d
- fix(crypto/blowfish): Return null data when encrypting or decrypting null data by @gouguoyin in e9c1905
- fix(crypto/des): Return null data when encrypting or decrypting null data by @gouguoyin in 7ad600f
- test: Use
mock.NewFileinstead ofstrings.NewReaderandbytes.NewReaderby @gouguoyin in c70e218
v1.1.0 (2025-08-23)
⚠️ This is a breaking change version, please upgrade with caution, but it is strongly recommended to upgrade
✨ Features
- Add support for
file streamencoding/decoding, encryption/decryption, Hash/HMAC, signature/verification - Add new
ByBase32Hexencoding/decoding method - Add support for
base32/base32Hexencoding custom character - Add support for
base45encoding custom character - Add support for
base62encoding custom character - Add support for
base64/base64Urlencoding custom character
🔧 Refactors
- Delete
BySafeURLencoding/decoding method - Delete
Sm3hash algorithm (hash) and message authentication code algorithm (hmac) - Rename
ByBase64URLencoding/decoding method toByBase64Url - Hash algorithm (
hash) calling method changed fromdongle.Encrypt.ByXXX()todongle.Hash.ByXXX() - Message authentication code algorithm (
hmac) calling method changed fromdongle.Encrypt.ByHmacXXX()todongle.Hash.WithKey().ByXXX() - Refactor
AES,DES,3DES,Blowfishand other symmetric encryption/decryption methods, uniformly usecipher.NewXXXCipher() - Refactor
RSAand other asymmetric encryption/decryption methods, uniformly usekeypair.NewXXXKeyPair()
What's Changed (55)
- Update content by @gouguoyin in 41dbddf
- Unified error handling by @gouguoyin in 79209ec
- Update introduction by @gouguoyin in 839738a
- Update references link by @gouguoyin in 178ccbf
- build: Upgrade go and dependency library version by @gouguoyin in bd915fa
- chore: Delete unnecessary directories and files by @gouguoyin in 4050bc9
- feat(coding): Add streaming encoding and decoding for base32 by @gouguoyin in bd888e4
- feat(coding): Refactor encoding and decoding for base32, and added streaming support by @gouguoyin in 3658c88
- feat(coding): Refactor encoding and decoding for base45, and added streaming support by @gouguoyin in 4a9e5f1
- feat(coding): Refactor encoding and decoding for base58, and added streaming support by @gouguoyin in 94af864
- feat(coding): Refactor encoding and decoding for base62, and added streaming support by @gouguoyin in ec8cf47
- feat(coding): Refactor encoding and decoding for base64, and added streaming support by @gouguoyin in fab63f8
- feat(coding): Refactor encoding and decoding for base85, and added streaming support by @gouguoyin in 12b8686
- feat(coding): Refactor encoding and decoding for base91, and added streaming support by @gouguoyin in 6253df9
- feat(coding): Refactor encoding and decoding for base100, and added streaming support by @gouguoyin in 7938084
- feat(coding): Refactor encoding and decoding for hex, and added streaming support by @gouguoyin in 90421f9
- feat(coding): Refactor encoding and decoding for morse, and added streaming support by @gouguoyin in e556a27
- test(coding): Add unit tests and examples for Base32 encoding and decoding by @gouguoyin in 49e8824
- test(coding): Add unit tests and examples for Base45 encoding and decoding by @gouguoyin in 8bb6af4
- test(coding): Add unit tests and examples for Base58 encoding and decoding by @gouguoyin in 9acead1
- test(coding): Add unit tests and examples for Base62 encoding and decoding by @gouguoyin in 0e759d4
- test(coding): Add unit tests and examples for Base64 encoding and decoding by @gouguoyin in 56b939f
- test(coding): Add unit tests and examples for Base85 encoding and decoding by @gouguoyin in e3c40d3
- test(coding): Add unit tests and examples for Base91 encoding and decoding by @gouguoyin in 581084d
- test(coding): Add unit tests and examples for Base100 encoding and decoding by @gouguoyin in 8a649aa
- feat(coding): Add a universal decoder by @gouguoyin in 56e267d
- feat(coding): Add a universal encoder by @gouguoyin in df83e3d
- test(coding): Add Decoder unit test by @gouguoyin in c8cd146
- test(coding): Add Encoder unit test by @gouguoyin in 9ffeeb2
- test(coding): Add unit tests and examples for Hex encoding and decoding by @gouguoyin in 7f0ebed
- test(coding): Add unit tests and examples for Morse encoding and decoding by @gouguoyin in e090a75
- feat(utils): Add string and byte slice conversion tools by @gouguoyin in 3d8531a
- feat: Create a dongle package and initialize the basic structure by @gouguoyin in be20106
- test(mock): Add mock file implementation and related tests by @gouguoyin in 4966d26
- feat(hash): Reconstruct hash algorithm by @gouguoyin in a72d1b5
- feat(crypto): Reconstruct crypto algorithm by @gouguoyin in 935cb7f
- test: xxx_unit_test.go -> xxx_test.go by @gouguoyin in a015292
- feat: Add a Hasher instance by @gouguoyin in 421a980
- build: Update the dependency version in
go.modby @gouguoyin in 195b44c - docs: Add a Japanese README file by @gouguoyin in 64b7b5c
- build: Update import path by @gouguoyin in 290a5d2
- docs: Update the code coverage badge link in the README file by @gouguoyin in 918a4c7
- docs:HASH -> Hash, HMAC -> Hmac by @gouguoyin in bfe4ef9
- refactor: Unify import sequence by @gouguoyin in 1312eb8
- refactor(rsa): Reconstruct signature and verification by @gouguoyin in f5bda3f
- refactor(crypto): Support streaming decryption by @gouguoyin in a3fdee1
- docs(README): Update project documents and logo links by @gouguoyin in a7c712b
- ci: Update workflow configuration and code coverage branch by @gouguoyin in 1f09724
- ci: Update workflow configuration by @gouguoyin in 1956fbc
- ci: Update code coverage branch by @gouguoyin in dfb63f6
- test: Remove utils/converter_example_test.go by @gouguoyin in 17e9909
- ci: Update the testing workflow to include all directories by @gouguoyin in f2c8a46
- feat: Add version number constant by @gouguoyin in f6f6061
- docs(readme): Update the README file in multiple languages by @gouguoyin in 28993a4
- docs: Update the project introduction in the README file by @gouguoyin in eb8def1
v1.0.1 (2024-11-22)
✨ Features
base62supports custom encoding tables
🐛 Fixes
- Fix bug with
AES-CBC-PKCS5encryption/decryption errors
🔧 Refactors
- Optimize code quality and organizational structure
- Delete
errors.gofile, migrate error messages to individual files - Unify unit test format
- Remove Chinese comments
What's Changed (22)
- Changed badge url by @gouguoyin in 5f1a726
- update by @gouguoyin in 2703673
- Changed badge address by @gouguoyin in 343a3c2
- 修改徽章地址 by @gouguoyin in 0a934f5
- Unified Unit test Format by @gouguoyin in 09b1657
- Bump codecov/codecov-action from 4 to 5 by @gouguoyin in cee97bf
- Support custom alphabet table by @gouguoyin in 3d21a8e
- Support custom alphabet table for base62 by @gouguoyin in e53528a
- Remove benchmark file by @gouguoyin in 77fb897
- Remove errors from errors.go to the current file by @gouguoyin in c286a54
- Remove Chinese annotations by @gouguoyin in c969116
- Change key type from
interface{}to[]byteby @gouguoyin in 1f43106 - Change privateKey and publicKey type from
interface{}to[]byteby @gouguoyin in d92e678 - Upgrade version by @gouguoyin in 7afcd5e
- github.com/golang-module/dongle -> github.com/dromara/dongle by @gouguoyin in 34d2c49
- Add
WithKeyandWithIVmethods by @gouguoyin in fdef30b - Remove github.com/golang-module/dongle by @gouguoyin in 42685d4
- Remove errors.go by @gouguoyin in f0b67fb
- Update content about
base62by @gouguoyin in 3623058 - Update content by @gouguoyin in 4a68d5f
- Upgrade version to
1.0.1by @gouguoyin in f81202d - Remove useless type conversions by @gouguoyin in 42d5ae3
v1.0.0 (2024-11-11)
🐛 Fixes
- Fixed panic caused by AES/ECB/PKCS5 padding
📝 Docs
- Changed repository and badge urls
What's Changed (5)
- Fixed: AES/ECB/PCKS5padding panic by xiaoyiyu in 5497c86
- Update content by @gouguoyin in f009269
- Upgrade version by @gouguoyin in 3293d42
- golang-module/dongle->dromara/dongle by @gouguoyin in de7c99b
- Changed badge url by @gouguoyin in 50691b6
For change logs of earlier versions, please refer to releases