Skip to content

Instantly share code, notes, and snippets.

View wqweto's full-sized avatar

Vladimir Vissoultchev wqweto

View GitHub Profile
@wqweto
wqweto / mdTea.bas
Created March 17, 2024 10:58
[VB6/VBA] Wheeler & Needham’s Tiny Encryption Algorithm
'--- mdTea.bas -- Wheeler & Needham’s Tiny Encryption Algorithm
Option Explicit
DefObj A-Z
#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)
#Else
@wqweto
wqweto / README.md
Last active March 13, 2024 14:08
Signing Web Service

How to use

You can use it from command line with curl like this

c:> curl -sSL -F file=@project1.exe http://localhost:4500/sign -o project1_signed.exe --fail || echo failed
@wqweto
wqweto / mdAES.bas
Last active January 11, 2024 14:22
Pure VB6 impl of AES in CBC, CTR, GCM and CCM modes
'--- mdAES.bas
Option Explicit
DefObj A-Z
#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)
Private Declare PtrSafe Function ArrPtr Lib "vbe7" Alias "VarPtr" (Ptr() As Any) As LongPtr
@wqweto
wqweto / TextBoxW.ctl
Last active March 31, 2023 10:48
Krool's TextBoxW using MST
Option Explicit
#If False Then
Private TxtCharacterCasingNormal, TxtCharacterCasingUpper, TxtCharacterCasingLower
Private TxtIconNone, TxtIconInfo, TxtIconWarning, TxtIconError
Private TxtNetAddressFormatNone, TxtNetAddressFormatDNSName, TxtNetAddressFormatIPv4, TxtNetAddressFormatIPv6
Private TxtNetAddressTypeNone, TxtNetAddressTypeIPv4Address, TxtNetAddressTypeIPv4Service, TxtNetAddressTypeIPv4Network, TxtNetAddressTypeIPv6Address, TxtNetAddressTypeIPv6AddressNoScope, TxtNetAddressTypeIPv6Service, TxtNetAddressTypeIPv6ServiceNoScope, TxtNetAddressTypeIPv6Network, TxtNetAddressTypeDNSName, TxtNetAddressTypeDNSService, TxtNetAddressTypeIPAddress, TxtNetAddressTypeIPAddressNoScope, TxtNetAddressTypeIPService, TxtNetAddressTypeIPServiceNoScope, TxtNetAddressTypeIPNetwork, TxtNetAddressTypeAnyAddress, TxtNetAddressTypeAnyAddressNoScope, TxtNetAddressTypeAnyService, TxtNetAddressTypeAnyServiceNoScope
#End If
Public Enum TxtCharacterCasingConstants
TxtCharacterCasingNormal = 0
TxtCharacterCasingUpper = 1
@wqweto
wqweto / fn_sys_GetEncodedJwt.sql
Created March 30, 2023 11:06
Encode JSON Web Token in MSSQL
IF OBJECT_ID('fn_sys_GetEncodedJwt') IS NOT NULL DROP FUNCTION fn_sys_GetEncodedJwt
GO
/*
DECLARE @Header NVARCHAR(MAX) = N'{"alg":"HS512","typ":"JWT"}', @Payload NVARCHAR(MAX) = N'{"sub":"1234567890","name":"JohnDoe","iat":1516239022}'
SELECT dbo.fn_sys_GetEncodedJwt('HS512', @Header, @Payload, CONVERT(VARBINARY(MAX), 'Password'))
*/
CREATE FUNCTION fn_sys_GetEncodedJwt (
@Algo VARCHAR(50)
, @Header NVARCHAR(MAX)
@wqweto
wqweto / mdAscon.bas
Last active February 19, 2023 21:40
[VB6/VBA] Ascon Lightweight Authenticated Encryption & Hashing
'--- mdAscon.bas
Option Explicit
DefObj A-Z
#Const HasPtrSafe = (VBA7 <> 0)
#Const HasOperators = (TWINBASIC <> 0)
#Const DebugState = False
#If HasPtrSafe Then
Private Declare PtrSafe Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As LongPtr)
@wqweto
wqweto / stdole2.idl
Created December 21, 2022 16:16
stdole2.tlb differences win7 vs win11
// Generated .IDL file (by the OLE/COM Object Viewer)
//
// typelib filename: stdole2.tlb
[
uuid(00020430-0000-0000-C000-000000000046),
version(2.0),
helpstring("OLE Automation")
]
library stdole
@wqweto
wqweto / mdHalfSiphash.bas
Last active December 18, 2022 18:46
[VBA/VB6] SipHash cryptographically secure keyed hash function
'--- mdHalfSiphash.bas
Option Explicit
DefObj A-Z
#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)
Private Declare PtrSafe Function WideCharToMultiByte Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpWideCharStr As LongPtr, ByVal cchWideChar As Long, lpMultiByteStr As Any, ByVal cchMultiByte As Long, ByVal lpDefaultChar As Long, ByVal lpUsedDefaultChar As Long) As Long
@wqweto
wqweto / mdArgon2.bas
Last active November 18, 2022 19:34
[VB6/VBA] Argon2 KDF implementation for password hashing
'--- mdArgon2.bas
Option Explicit
DefObj A-Z
#Const HasPtrSafe = (VBA7 <> 0)
#Const HasOperators = (TWINBASIC <> 0)
#Const DebugMode = False
#If HasPtrSafe Then
Private Declare PtrSafe Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As LongPtr)
@wqweto
wqweto / mdBlake2b.bas
Last active November 18, 2022 08:57
[VB6/VBA] BLAKE2 and BLAKE3 hash functions and MAC
'--- mdBlake2b.bas
Option Explicit
DefObj A-Z
#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)
Private Declare PtrSafe Sub FillMemory Lib "kernel32" Alias "RtlFillMemory" (Destination As Any, ByVal Length As LongPtr, ByVal Fill As Byte)