Skip to content

Instantly share code, notes, and snippets.

AES-256 encryption and decryption in PHP and C#

Update: There is a more secure version available. Details

PHP

<?php

$plaintext = 'My secret message 1234';
@yoga-
yoga- / randomPassword.php
Last active September 15, 2023 19:37
PHP random password generator - contains at least one lower case letter, one upper case letter, one number and one special character,
//generates a random password of length minimum 8
//contains at least one lower case letter, one upper case letter,
// one number and one special character,
//not including ambiguous characters like iIl|1 0oO
function randomPassword($len = 8) {
//enforce min length 8
if($len < 8)
$len = 8;