Skip to content

Instantly share code, notes, and snippets.

View wqweto's full-sized avatar

Vladimir Vissoultchev wqweto

View GitHub Profile
@wqweto
wqweto / mdCurve25519.bas
Last active November 15, 2025 12:39
[VB6/VBA] X25519 for ECDH key exchange and Ed25519 for EdDSA signatures
'--- mdCurve25519.bas
Option Explicit
DefObj A-Z
#Const HasPtrSafe = (VBA7 <> 0)
#Const HasSha512 = (CRYPT_HAS_SHA512 <> 0)
#If HasPtrSafe Then
Private Declare PtrSafe Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As LongPtr)
Private Declare PtrSafe Function RtlGenRandom Lib "advapi32" Alias "SystemFunction036" (RandomBuffer As Any, ByVal RandomBufferLength As Long) As Long
@wqweto
wqweto / mdSha2.bas
Last active November 15, 2025 12:40
[VB6/VBA] Pure VB6 implementation of SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/256 and SHA-512/224 incl. HMAC
'--- mdSha2.bas
Option Explicit
DefObj A-Z
#Const HasSha512 = (CRYPT_HAS_SHA512 <> 0)
#Const HasPtrSafe = (VBA7 <> 0)
#Const HasOperators = (TWINBASIC <> 0)
#If HasPtrSafe Then
Private Declare PtrSafe Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As LongPtr)
@wqweto
wqweto / mdSha3.bas
Last active November 15, 2025 12:41
[VB6/VBA] SHA-3 pure VB implementation
'--- mdSha3.bas
Option Explicit
DefObj A-Z
#Const HasPtrSafe = (VBA7 <> 0)
#Const LargeAddressAware = (Win64 = 0 And VBA7 = 0 And VBA6 = 0 And VBA5 = 0)
#Const HasOperators = (TWINBASIC <> 0)
#If HasPtrSafe Then
Private Declare PtrSafe Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As LongPtr)
@wqweto
wqweto / SimpleAES.cs
Last active November 15, 2025 12:41
Simple PBKDF2 based AES-256 encryption
public class SimpleAES
{
private const int SALT_SIZE = 8;
private const int KEY_SIZE = 256;
public static string Encrypt(string text, string passphrase)
{
byte[] result = null;
if (Encrypt(Encoding.UTF8.GetBytes(text), passphrase, ref result))
{
'--- mdSerialNumber.bas
Option Explicit
DefObj A-Z
#Const HasPtrSafe = (VBA7 <> 0) Or (TWINBASIC <> 0)
'=========================================================================
' API
'=========================================================================
@wqweto
wqweto / mdStreamSupport.bas
Last active November 18, 2022 08:58
[VB6/VBA] IStream wrapper module
'--- mdStreamSupport.bas
Option Explicit
DefObj A-Z
#Const HasPtrSafe = (VBA7 <> 0) Or (TWINBASIC <> 0)
'=========================================================================
' API
'=========================================================================
@wqweto
wqweto / usp_adm_CreateLinkView.sql
Last active January 14, 2022 07:58
Working with external data in SQL Server
IF OBJECT_ID('usp_adm_CreateLinkView') IS NOT NULL DROP PROC usp_adm_CreateLinkView
GO
CREATE PROC usp_adm_CreateLinkView (
@ConnStrOrFile VARCHAR(1000)
, @TableName sysname = NULL
, @ViewName sysname = NULL
, @Flags INT = NULL -- 1 - CSV header, 2 - CSV unicode
) AS
SET NOCOUNT ON
@wqweto
wqweto / mdAesCbc.bas
Last active November 15, 2025 12:43
[VB6/VBA] openssl compatible AES-256 in CBC mode and PBKDF2 w/ SHA-512 for WinXP using legacy CryptoAPI
'--- mdAesCbc.bas
Option Explicit
DefObj A-Z
#Const HasPtrSafe = (VBA7 <> 0) Or (TWINBASIC <> 0)
'=========================================================================
' API
'=========================================================================
@wqweto
wqweto / Program.cs
Created October 13, 2021 16:54
ECDSA server certificate signed by a ECDSA self-signed CA
using System;
using System.IO;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
@wqweto
wqweto / FM20.IDL
Last active April 4, 2023 18:24
Typelib resource ID 3 from MSVBVM60.DLL
// Generated .IDL file (by the OLE/COM Object Viewer)
//
// typelib filename: FM20.DLL
[
uuid(0D452EE1-E08F-101A-852E-02608C4D0BB4),
version(2.0),
helpstring("Microsoft Forms 2.0 Object Library"),
helpfile("fm20.hlp"),
helpcontext(00000000),