
Security News
NVD Quietly Sweeps 100K+ CVEs Into a “Deferred” Black Hole
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
Python extension library for GM (GuoMi) cryptographic algorithms, providing a set of fundamental cryptographic algorithms.
Implemented in C language, encapsulated based on the native CPython interface, without dependencies on any third-party libraries.
pip install gmalglib
For submodules under gmalglib, different algorithm encapsulations are respectively exported, and can be utilized in an object-oriented manner.
from gmalglib.sm3 import SM3
obj = SM3()
obj.update(b"message")
obj.update(b"digest")
print(obj.digest().hex())
Under gmalglib.wrapped, member methods of all algorithm objects are encapsulated, providing a procedural call method. Furthermore, the gmalglib namespace is imported, enabling direct usage.
import gmalglib
print(gmalglib.sm3_digest(b"messagedigest").hex())
For all sections involving random number generators, custom parameters for random number generation are provided, implemented in the form of callback functions. The function type is Callable[[int], bytes]
, meaning it generates a byte string of a specified length.
def rnd_fn(n: int) -> bytes: ...
If no random number generator is passed, the default system-related random number generator is used. On Windows, it utilizes BCryptGenRandom
, while other systems use /dev/urandom
for implementation, which is similar to the Python standard library function os.urandom
.
For specific implementation details, refer to random.c under the OsRandomProc
function.
The benchmark test code can be found in benchmark.py. The test results on the 13th Gen Intel(R) Core(TM) i7-13700H
are as follows:
==================== SM2 Benchmark Test (1000 times, 32 bytes data) ====================
SM2.encrypt : 0.454363s (2200.88 times/s)
SM2.decrypt : 0.356014s (2808.88 times/s)
SM2.sign_digest : 0.088565s (11291.12 times/s)
SM2.verify_digest : 0.409243s (2443.54 times/s)
SM2.sign : 0.087475s (11431.80 times/s)
SM2.verify : 0.404026s (2475.09 times/s)
SM2.begin_key_exchange : 0.086665s (11538.62 times/s)
SM2.end_key_exchange : 0.536552s (1863.75 times/s)
==================== SM3 Benchmark Test (1,000,000,000 bytes data) ====================
SM3.update & SM3.digest : 3.083487s (324,308,109 B/s)
==================== SM4 Benchmark Test (1000000 times) ====================
SM4.encrypt : 0.197393s (5066040.91 times/s)
SM4.decrypt : 0.185619s (5387391.13 times/s)
==================== ZUC Benchmark Test (1000000 times) ====================
zuc.generate : 0.028821s (34696561.22 times/s)
FAQs
Python package implementing GM algorithms in C.
We found that gmalglib demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
Research
Security News
Lazarus-linked threat actors expand their npm malware campaign with new RAT loaders, hex obfuscation, and over 5,600 downloads across 11 packages.
Security News
Safari 18.4 adds support for Iterator Helpers and two other TC39 JavaScript features, bringing full cross-browser coverage to key parts of the ECMAScript spec.