Skip to content

Instantly share code, notes, and snippets.

View dafahan's full-sized avatar
🎯
Focusing

Dafahan dafahan

🎯
Focusing
View GitHub Profile
@dafahan
dafahan / aes-256-go-php-py-generate.php
Last active March 29, 2024 12:34
AES-256 encryption and decryption in PHP , Go, and Python
<?php
//the key & iv should be generated with php
// Generate a random key
$key_length = 32; // 256 bits for AES-256
$key = openssl_random_pseudo_bytes($key_length);
// Encode the key in base64 format for storage or transmission
$encoded_key = base64_encode($key);
echo "Generated Key: " . $encoded_key . "\n";