[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6H9D2YJFNBTAYEZDXPADYGD":3,"skill-same:01M6H9D2YJFNBTAYEZDXPADYGD":51},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":22,"linkOnly":23,"markdownContent":24,"markdownBody":25,"frontMatter":26,"refName":29,"commitSha":30,"skillDirectory":31,"forksCount":14,"repositoryHtmlUrl":32,"repositoryHomepageUrl":6,"ownerHtmlUrl":33,"ownerBlogUrl":34,"ownerDescription":35,"updatedAt":36,"install":37,"resources":50},"01M6H9D2YJFNBTAYEZDXPADYGD","cryptography",null,"Cryptography fundamentals and implementation","NeuralBlitz\u002FMito","NeuralBlitz","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F79354388?v=4","01M6H8T2TFH477HRS0KTSTKR2E","David Riggs","01M6H8T2YQQDXPYM092P670Z21",0,"MIT","https:\u002F\u002Fgithub.com\u002FNeuralBlitz\u002FMito\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fcryptography\u002FSKILL.md",[],[5,19,20,21],"security","opencode","implementation","2026-11-10 10:12:30",false,"---\nname: cryptography\ndescription: Cryptography fundamentals and implementation\nlicense: MIT\ncompatibility: opencode\nmetadata:\n  audience: developers\n  category: security\n---\n\n## What I do\n- Explain cryptographic primitives and their uses\n- Implement symmetric and asymmetric encryption\n- Design secure key exchange protocols\n- Implement hashing and digital signatures\n- Choose appropriate algorithms for use cases\n\n## When to use me\nWhen learning about cryptography or implementing cryptographic solutions.\n\n## Symmetric Encryption\n\n### AES Modes of Operation\n```python\nfrom cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes\nfrom cryptography.hazmat.backends import default_backend\nimport os\n\ndef aes_gcm_encrypt(plaintext: bytes, key: bytes) -> tuple:\n    \"\"\"AES-GCM provides both confidentiality and authenticity\"\"\"\n    nonce = os.urandom(12)  # 96-bit nonce for GCM\n    \n    cipher = Cipher(\n        algorithms.AES(key),\n        modes.GCM(nonce),\n        backend=default_backend()\n    )\n    encryptor = cipher.encryptor()\n    ciphertext = encryptor.update(plaintext) + encryptor.finalize()\n    \n    return nonce, ciphertext, encryptor.tag\n\ndef aes_ctr_encrypt(plaintext: bytes, key: bytes) -> bytes:\n    \"\"\"AES-CTR turns block cipher into stream cipher\"\"\"\n    nonce = os.urandom(16)\n    \n    cipher = Cipher(\n        algorithms.AES(key),\n        modes.CTR(nonce),\n        backend=default_backend()\n    )\n    return cipher.encryptor().update(plaintext)\n\n# Use cases:\n# GCM - When you need authenticated encryption (most common)\n# CTR - When you need random access (disk encryption)\n# CBC - Legacy systems only (use GCM instead)\n```\n\n## Asymmetric Encryption\n\n### RSA Encryption\n```python\nfrom cryptography.hazmat.primitives.asymmetric import rsa, padding\nfrom cryptography.hazmat.primitives import hashes\n\ndef generate_rsa_keypair():\n    private_key = rsa.generate_private_key(\n        public_exponent=65537,\n        key_size=2048  # Minimum 2048 for security\n    )\n    public_key = private_key.public_key()\n    return private_key, public_key\n\ndef rsa_encrypt(plaintext: bytes, public_key) -> bytes:\n    return public_key.encrypt(\n        plaintext,\n        padding.OAEP(\n            mgf=padding.MGF1(algorithm=hashes.SHA256()),\n            algorithm=hashes.SHA256(),\n            label=None\n        )\n    )\n\ndef rsa_decrypt(ciphertext: bytes, private_key) -> bytes:\n    return private_key.decrypt(\n        ciphertext,\n        padding.OAEP(\n            mgf=padding.MGF1(algorithm=hashes.SHA256()),\n            algorithm=hashes.SHA256(),\n            label=None\n        )\n    )\n\n# Hybrid encryption (for large data)\ndef hybrid_encrypt(data: bytes, rsa_public_key):\n    # Generate symmetric key for data\n    symmetric_key = os.urandom(32)\n    \n    # Encrypt data with symmetric key\n    nonce, ciphertext, tag = aes_gcm_encrypt(data, symmetric_key)\n    \n    # Encrypt symmetric key with RSA\n    encrypted_key = rsa_encrypt(symmetric_key, rsa_public_key)\n    \n    return encrypted_key, nonce, ciphertext, tag\n```\n\n### Elliptic Curve Cryptography\n```python\nfrom cryptography.hazmat.primitives.asymmetric import ec\n\ndef generate_ec_keypair():\n    private_key = ec.generate_private_key(ec.SECP256R1())\n    return private_key, private_key.public_key()\n\ndef ecdsa_sign(message: bytes, private_key):\n    return private_key.sign(\n        message,\n        ec.ECDSA(hashes.SHA256())\n    )\n\ndef ecdsa_verify(message: bytes, signature: bytes, public_key):\n    try:\n        public_key.verify(signature, message, ec.ECDSA(hashes.SHA256()))\n        return True\n    except:\n        return False\n\n# EC is preferred over RSA for new systems\n# Same security with smaller keys and faster operations\n```\n\n## Hashing\n\n### Choosing Hash Functions\n```python\nfrom cryptography.hazmat.primitives import hashes\nimport hashlib\n\ndef secure_hash(data: bytes) -> str:\n    \"\"\"Use SHA-256 for general hashing\"\"\"\n    return hashlib.sha256(data).hexdigest()\n\ndef blake2_hash(data: bytes) -> str:\n    \"\"\"BLAKE2 is faster than SHA-256 and equally secure\"\"\"\n    return hashlib.blake2b(data).hexdigest()\n\n# NEVER use for passwords:\n# - MD5 (broken)\n# - SHA-1 (broken)\n# - SHA-256 (not designed for passwords)\n\n# Use for passwords:\n# - bcrypt\n# - scrypt\n# - Argon2\n\ndef argon2_hash(password: str) -> str:\n    import argon2\n    ph = argon2.PasswordHasher(\n        time_cost=3,\n        memory_cost=65536,\n        parallelism=4,\n        hash_len=32,\n        salt_len=16\n    )\n    return ph.hash(password)\n\ndef verify_argon2(password: str, hash: str) -> bool:\n    ph = argon2.PasswordHasher()\n    try:\n        ph.verify(hash, password)\n        return True\n    except:\n        return False\n```\n\n## Key Exchange\n\n### Diffie-Hellman\n```python\nfrom cryptography.hazmat.primitives.asymmetric import dh\nfrom cryptography.hazmat.primitives import serialization\n\ndef generate_dh_parameters():\n    # Use standardized parameters\n    return dh.generate_parameters(generator=2, key_size=2048)\n\ndef dh_key_exchange(paramters):\n    private_key = paramtes.generate_private_key()\n    public_key = private_key.public_key()\n    \n    # Share public_key with other party\n    # Other party does the same\n    # Both derive same shared secret\n    \n    return private_key, public_key\n\ndef derive_shared_key(my_private_key, their_public_key):\n    shared_key = my_private_key.exchange(their_public_key)\n    # Derive symmetric key from shared secret\n    return hashlib.sha256(shared_key).digest()\n```\n\n## Digital Signatures\n```python\n# ECDSA (recommended)\nfrom cryptography.hazmat.primitives.asymmetric import ec\nfrom cryptography.hazmat.primitives import hashes\n\nprivate_key = ec.generate_private_key(ec.SECP256R1())\nsignature = private_key.sign(\n    b\"message\",\n    ec.ECDSA(hashes.SHA256())\n)\n\n# Verify\npublic_key = private_key.public_key()\npublic_key.verify(signature, b\"message\", ec.ECDSA(hashes.SHA256()))\n\n# Ed25519 (modern, recommended)\nfrom cryptography.hazmat.primitives.asymmetric import ed25519\n\nprivate_key = ed25519.Ed25519PrivateKey.generate()\nsignature = private_key.sign(b\"message\")\npublic_key = private_key.public_key()\npublic_key.verify(signature, b\"message\")\n```\n\n## Random Number Generation\n```python\nimport secrets\nimport os\n\n# Cryptographically secure random\nrandom_bytes = secrets.token_bytes(32)  # For keys\nrandom_int = secrets.randbelow(1000000)  # For numbers\n\n# System CSPRNG (used by secrets)\nsystem_random = os.urandom(32)\n\n# NEVER use:\n# - random module (not secure)\n# - Mersenne Twister (predictable)\n# - time-based seeds\n```\n","## What I do\n- Explain cryptographic primitives and their uses\n- Implement symmetric and asymmetric encryption\n- Design secure key exchange protocols\n- Implement hashing and digital signatures\n- Choose appropriate algorithms for use cases\n\n## When to use me\nWhen learning about cryptography or implementing cryptographic solutions.\n\n## Symmetric Encryption\n\n### AES Modes of Operation\n```python\nfrom cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes\nfrom cryptography.hazmat.backends import default_backend\nimport os\n\ndef aes_gcm_encrypt(plaintext: bytes, key: bytes) -> tuple:\n    \"\"\"AES-GCM provides both confidentiality and authenticity\"\"\"\n    nonce = os.urandom(12)  # 96-bit nonce for GCM\n    \n    cipher = Cipher(\n        algorithms.AES(key),\n        modes.GCM(nonce),\n        backend=default_backend()\n    )\n    encryptor = cipher.encryptor()\n    ciphertext = encryptor.update(plaintext) + encryptor.finalize()\n    \n    return nonce, ciphertext, encryptor.tag\n\ndef aes_ctr_encrypt(plaintext: bytes, key: bytes) -> bytes:\n    \"\"\"AES-CTR turns block cipher into stream cipher\"\"\"\n    nonce = os.urandom(16)\n    \n    cipher = Cipher(\n        algorithms.AES(key),\n        modes.CTR(nonce),\n        backend=default_backend()\n    )\n    return cipher.encryptor().update(plaintext)\n\n# Use cases:\n# GCM - When you need authenticated encryption (most common)\n# CTR - When you need random access (disk encryption)\n# CBC - Legacy systems only (use GCM instead)\n```\n\n## Asymmetric Encryption\n\n### RSA Encryption\n```python\nfrom cryptography.hazmat.primitives.asymmetric import rsa, padding\nfrom cryptography.hazmat.primitives import hashes\n\ndef generate_rsa_keypair():\n    private_key = rsa.generate_private_key(\n        public_exponent=65537,\n        key_size=2048  # Minimum 2048 for security\n    )\n    public_key = private_key.public_key()\n    return private_key, public_key\n\ndef rsa_encrypt(plaintext: bytes, public_key) -> bytes:\n    return public_key.encrypt(\n        plaintext,\n        padding.OAEP(\n            mgf=padding.MGF1(algorithm=hashes.SHA256()),\n            algorithm=hashes.SHA256(),\n            label=None\n        )\n    )\n\ndef rsa_decrypt(ciphertext: bytes, private_key) -> bytes:\n    return private_key.decrypt(\n        ciphertext,\n        padding.OAEP(\n            mgf=padding.MGF1(algorithm=hashes.SHA256()),\n            algorithm=hashes.SHA256(),\n            label=None\n        )\n    )\n\n# Hybrid encryption (for large data)\ndef hybrid_encrypt(data: bytes, rsa_public_key):\n    # Generate symmetric key for data\n    symmetric_key = os.urandom(32)\n    \n    # Encrypt data with symmetric key\n    nonce, ciphertext, tag = aes_gcm_encrypt(data, symmetric_key)\n    \n    # Encrypt symmetric key with RSA\n    encrypted_key = rsa_encrypt(symmetric_key, rsa_public_key)\n    \n    return encrypted_key, nonce, ciphertext, tag\n```\n\n### Elliptic Curve Cryptography\n```python\nfrom cryptography.hazmat.primitives.asymmetric import ec\n\ndef generate_ec_keypair():\n    private_key = ec.generate_private_key(ec.SECP256R1())\n    return private_key, private_key.public_key()\n\ndef ecdsa_sign(message: bytes, private_key):\n    return private_key.sign(\n        message,\n        ec.ECDSA(hashes.SHA256())\n    )\n\ndef ecdsa_verify(message: bytes, signature: bytes, public_key):\n    try:\n        public_key.verify(signature, message, ec.ECDSA(hashes.SHA256()))\n        return True\n    except:\n        return False\n\n# EC is preferred over RSA for new systems\n# Same security with smaller keys and faster operations\n```\n\n## Hashing\n\n### Choosing Hash Functions\n```python\nfrom cryptography.hazmat.primitives import hashes\nimport hashlib\n\ndef secure_hash(data: bytes) -> str:\n    \"\"\"Use SHA-256 for general hashing\"\"\"\n    return hashlib.sha256(data).hexdigest()\n\ndef blake2_hash(data: bytes) -> str:\n    \"\"\"BLAKE2 is faster than SHA-256 and equally secure\"\"\"\n    return hashlib.blake2b(data).hexdigest()\n\n# NEVER use for passwords:\n# - MD5 (broken)\n# - SHA-1 (broken)\n# - SHA-256 (not designed for passwords)\n\n# Use for passwords:\n# - bcrypt\n# - scrypt\n# - Argon2\n\ndef argon2_hash(password: str) -> str:\n    import argon2\n    ph = argon2.PasswordHasher(\n        time_cost=3,\n        memory_cost=65536,\n        parallelism=4,\n        hash_len=32,\n        salt_len=16\n    )\n    return ph.hash(password)\n\ndef verify_argon2(password: str, hash: str) -> bool:\n    ph = argon2.PasswordHasher()\n    try:\n        ph.verify(hash, password)\n        return True\n    except:\n        return False\n```\n\n## Key Exchange\n\n### Diffie-Hellman\n```python\nfrom cryptography.hazmat.primitives.asymmetric import dh\nfrom cryptography.hazmat.primitives import serialization\n\ndef generate_dh_parameters():\n    # Use standardized parameters\n    return dh.generate_parameters(generator=2, key_size=2048)\n\ndef dh_key_exchange(paramters):\n    private_key = paramtes.generate_private_key()\n    public_key = private_key.public_key()\n    \n    # Share public_key with other party\n    # Other party does the same\n    # Both derive same shared secret\n    \n    return private_key, public_key\n\ndef derive_shared_key(my_private_key, their_public_key):\n    shared_key = my_private_key.exchange(their_public_key)\n    # Derive symmetric key from shared secret\n    return hashlib.sha256(shared_key).digest()\n```\n\n## Digital Signatures\n```python\n# ECDSA (recommended)\nfrom cryptography.hazmat.primitives.asymmetric import ec\nfrom cryptography.hazmat.primitives import hashes\n\nprivate_key = ec.generate_private_key(ec.SECP256R1())\nsignature = private_key.sign(\n    b\"message\",\n    ec.ECDSA(hashes.SHA256())\n)\n\n# Verify\npublic_key = private_key.public_key()\npublic_key.verify(signature, b\"message\", ec.ECDSA(hashes.SHA256()))\n\n# Ed25519 (modern, recommended)\nfrom cryptography.hazmat.primitives.asymmetric import ed25519\n\nprivate_key = ed25519.Ed25519PrivateKey.generate()\nsignature = private_key.sign(b\"message\")\npublic_key = private_key.public_key()\npublic_key.verify(signature, b\"message\")\n```\n\n## Random Number Generation\n```python\nimport secrets\nimport os\n\n# Cryptographically secure random\nrandom_bytes = secrets.token_bytes(32)  # For keys\nrandom_int = secrets.randbelow(1000000)  # For numbers\n\n# System CSPRNG (used by secrets)\nsystem_random = os.urandom(32)\n\n# NEVER use:\n# - random module (not secure)\n# - Mersenne Twister (predictable)\n# - time-based seeds\n```\n",{"name":5,"license":15,"metadata":27,"description":7,"compatibility":20},{"audience":28,"category":19},"developers","main","2ea764e153842704d24a2e9aa4170441a7f03081",".opencode\u002Fskills\u002Fcryptography","https:\u002F\u002Fgithub.com\u002FNeuralBlitz\u002FMito","https:\u002F\u002Fgithub.com\u002FNeuralBlitz","nuralnexus.org","Independent Multidisciplinary Researcher, Creative Producer, and AI Systems Architect\r\nAn independent creator and research-driven systems designer.","2026-11-12 03:13:05",{"source":8,"skillName":5,"commands":38,"prompt":48,"zipAvailable":49},[39,42,45],{"tool":40,"command":41},"npx","npx skills add NeuralBlitz\u002FMito --skill cryptography",{"tool":43,"command":44},"bunx","bunx skills add NeuralBlitz\u002FMito --skill cryptography",{"tool":46,"command":47},"pnpm","pnpm dlx skills add NeuralBlitz\u002FMito --skill cryptography","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FNeuralBlitz\u002FMito\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fcryptography\u002FSKILL.md",true,[],[52,68,80,92,100,125],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":22},"01M6HAZSAQK1S27CEZYAYJTQDX","wireless-communications","Wireless systems, mobile networks, and 5G\u002F6G","https:\u002F\u002Fgithub.com\u002FNeuralBlitz\u002FMito\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fwireless-communications\u002FSKILL.md",[],[59,60,61,62,63,64,65,66,20,67],"communications","wireless communications","wireless","systems","engineering","networks","5G","students","mobile",{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":22},"01M6HAZFX6E8NK3WZWDX5YCKYY","websockets","WebSocket implementation and best practices","https:\u002F\u002Fgithub.com\u002FNeuralBlitz\u002FMito\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fwebassembly\u002Fwebsockets\u002FSKILL.md",[],[70,75,76,21,20,77,78,79],"websocket implementation","time","real-time","websocket","best practices",{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":22},"01M6HAZ6DAXBQ7QHXXM1EM7715","vulnerability-auditing","Vulnerability assessment and auditing","https:\u002F\u002Fgithub.com\u002FNeuralBlitz\u002FMito\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fvulnerability-auditing\u002FSKILL.md",[],[87,88,19,89,20,90,91],"vulnerability","vulnerability auditing","vulnerability assessment","cybersecurity","assessment",{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":22},"01M6HAZ3FKF3CS9Z3J96RVE2ZE","vulnerability-assessment","Finding and assessing security vulnerabilities","https:\u002F\u002Fgithub.com\u002FNeuralBlitz\u002FMito\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fvue\u002Fvulnerability-assessment\u002FSKILL.md",[],[89,87,91,19,99,20],"vulnerabilities",{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":116,"publishedAt":22},"01M6HAYSHM6HKRKEHFP0SGZQX7","vlsi-design","Very-Large-Scale Integration circuit design and semiconductor engineering","https:\u002F\u002Fgithub.com\u002FNeuralBlitz\u002FMito\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fvlsi-design\u002FSKILL.md",[106,111],{"categoryNo":107,"categoryName":108,"taxonomyType":109,"taxonomyTypeDesc":110},"01JBSEEDCAT000000000000015","视觉设计","SCENARIO","使用场景",{"categoryNo":112,"categoryName":113,"taxonomyType":114,"taxonomyTypeDesc":115},"01JBSEEDCAT000000000000032","设计师","PROFESSION","适用职业",[117,118,119,120,121,63,122,20,123,66,124],"vlsi design","VLSI","design","hardware","integration","computer","scale","circuit",{"skillNo":126,"name":127,"nameZh":6,"description":128,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":129,"categories":130,"keywords":131,"publishedAt":22},"01M6HAYPQ30FFE2JXD7WQJ8R6C","unsupervised","Unsupervised learning concepts","https:\u002F\u002Fgithub.com\u002FNeuralBlitz\u002FMito\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fvisualization\u002Funsupervised\u002FSKILL.md",[],[127,132,20,133,134,135,136,137],"learning","intelligence","unsupervised learning","machine","concepts","machine-learning"]