Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lesscode-encryption

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lesscode-encryption

lesscode_encryption是基于Rust语言开发的加密算法库

  • 0.0.3
  • PyPI
  • Socket score

Maintainers
1

lesscode_encryption

lesscode_encryption是基于Rust语言开发的加密算法库

# sm2
from lesscode_encryption import LessCodeEncryption

key = LessCodeEncryption.sm2_gen_keypair()
origin_str = "hello navysummer"
sm2_encrypt_str = LessCodeEncryption.sm2_encrypt(key.pk, origin_str)
sm2_decrypt_str = LessCodeEncryption.sm2_decrypt(key.sk, sm2_encrypt_str)
assert sm2_decrypt_str == origin_str

# sm3
sm3_str = LessCodeEncryption.sm3_hex(origin_str)

# sm4
key = "8A3F8665AAEE6F7A0CB8F40B971E3373"
iv = "88BA27B390F466ABE7C4327E1E60270B"
sm4_ecb_encrypt_str = LessCodeEncryption.sm4_encrypt("ecb", origin_str, key)
sm4_ecb_decrypt_str = LessCodeEncryption.sm4_decrypt("ecb", sm4_ecb_encrypt_str, key)
assert sm4_ecb_decrypt_str == origin_str
sm4_cbc_encrypt_str = LessCodeEncryption.sm4_encrypt("cbc", origin_str, key, iv)
sm4_cbc_decrypt_str = LessCodeEncryption.sm4_decrypt("cbc", sm4_cbc_encrypt_str, key, iv)
assert sm4_cbc_decrypt_str == origin_str

FAQs


Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc