Skip to content

Instantly share code, notes, and snippets.

Avatar
🇻🇳
Viet Nam Number One

Lê Đăng Dũng ledunguit

🇻🇳
Viet Nam Number One
  • LD
View GitHub Profile
@ledunguit
ledunguit / systemctl.py
Created Mar 28, 2022
Systemctl without init 0
View systemctl.py
#! /usr/bin/python2
## generated from systemctl3.py - do not change
from __future__ import print_function
__copyright__ = "(C) 2016-2020 Guido U. Draheim, licensed under the EUPL"
__version__ = "1.5.4505"
import logging
logg = logging.getLogger("systemctl")
@ledunguit
ledunguit / RSAKeys.cs
Created Nov 8, 2021 — forked from ststeiger/RSAKeys.cs
Import and export RSA Keys between C# and PEM format using BouncyCastle
View RSAKeys.cs
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.OpenSsl;
using Org.BouncyCastle.Security;
using System;
using System.IO;
using System.Security.Cryptography;
namespace MyProject.Data.Encryption
{
@ledunguit
ledunguit / VS16NoTelem.bat
Created Sep 12, 2021 — forked from zeffy/VS16NoTelem.bat
Disable telemetry in Visual Studio 2019
View VS16NoTelem.bat
@echo off
fltmc >nul 2>&1 || (
echo This batch script requires administrator privileges. Right-click on
echo the script and select "Run as administrator".
goto :die
)
rem Change this path if you are using Community or Professional editions
set "VS_INSTALL_DIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise"
View AES-256 encryption and decryption in PHP and C#.md

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';
@ledunguit
ledunguit / aes_enc_dec.php
Created Aug 21, 2021 — forked from turret-io/aes_enc_dec.php
AES encryption/decryption in PHP
View aes_enc_dec.php
<?php
// DEFINE our cipher
define('AES_256_CBC', 'aes-256-cbc');
// Generate a 256-bit encryption key
// This should be stored somewhere instead of recreating it each time
$encryption_key = openssl_random_pseudo_bytes(32);
// Generate an initialization vector
// This *MUST* be available for decryption as well
@ledunguit
ledunguit / AES.cs
Created Aug 21, 2021 — forked from mhingston/AES.cs
AES-256-CBC for C# and Node
View AES.cs
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
class AES
{
public static string Encrypt(string plainText, string keyString)
{
byte[] cipherData;