Inherited from v1.0.0

crypto মডিউল

OpenSSL-চালিত ক্রিপ্টো প্রিমিটিভ — hash, HMAC, base64 (standard ও URL-safe), hex, সিকিউর র‍্যান্ডম, constant-time তুলনা।

import "crypto" as crypto;

print(crypto.hash("sha256", "hello"));               // hex digest
print(crypto.hmac("sha256", "secret", "msg"));       // hex
print(crypto.b64_encode("Hello!"));                  // SGVsbG8h
var token = crypto.random_hex(16);                   // 32-char hex token

হ্যাশিং

ফাংশনবর্ণনা
crypto.hash(algo, data) → stringHex digest। algo: "sha256", "sha512", "sha1", "md5"
crypto.hmac(algo, key, data) → stringHex HMAC।

কোডেক

ফাংশনবর্ণনা
crypto.b64_encode(data) / b64_decode(s)Standard base64।
crypto.b64url_encode(data) / b64url_decode(s)URL-safe base64 (no padding)।
crypto.hex_encode(data) / hex_decode(s)Bytes ↔ hex।

র‍্যান্ডম

ফাংশনবর্ণনা
crypto.random_bytes(n) → stringn ক্রিপ্টোগ্রাফিক্যালি সিকিউর র‍্যান্ডম বাইট।
crypto.random_hex(n) → stringn র‍্যান্ডম বাইট, 2n-character hex।

তুলনা

ফাংশনবর্ণনা
crypto.equals(a, b) → boolConstant-time তুলনা — token/HMAC যাচাইয়ের জন্য।

আরও দেখুন