Skip to content

Instantly share code, notes, and snippets.

View wqweto's full-sized avatar

Vladimir Vissoultchev wqweto

View GitHub Profile
@wqweto
wqweto / mdImageConvert.bas
Created August 23, 2024 14:31
[VB6] Convert PDF and PNG to ZPL
Option Explicit
DefObj A-Z
Private Const MODULE_NAME As String = "mdImageConvert"
'=========================================================================
' API
'=========================================================================
'--- for GdipCreateBitmapFromScan0
Private Const PixelFormat32bppPARGB As Long = &HE200B
@wqweto
wqweto / fn_sys_GetUuidV5.sql
Created June 1, 2024 14:12
Generates a name-based UUID, as described in RFC 4122 section 4.3
IF OBJECT_ID('fn_sys_GetUuidV5') IS NOT NULL DROP FUNCTION fn_sys_GetUuidV5
GO
-- SELECT dbo.fn_sys_GetUuidV5(CONVERT(UNIQUEIDENTIFIER, 'E11EAC0E-4D75-4567-BA60-683D357A9227'), 'Test42'), '73CF5B24-114A-5A5B-837C-64CF22468258'
-- SELECT dbo.fn_sys_GetUuidV5(CONVERT(UNIQUEIDENTIFIER, '6ba7b810-9dad-11d1-80b4-00c04fd430c8'), 'www.terraform.io'), 'A5008FAE-B28C-5BA5-96CD-82B4C53552D6'
-- SELECT dbo.fn_sys_GetUuidV5(CONVERT(UNIQUEIDENTIFIER, '6ba7b810-9dad-11d1-80b4-00c04fd430c8'), 'Проба'), 'E40F6EF0-210D-5F5B-B2B1-CABD47B5CBD9'
CREATE FUNCTION fn_sys_GetUuidV5 (
@Namespace SQL_VARIANT
, @Name SQL_VARIANT
) RETURNS UNIQUEIDENTIFIER
@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 [email protected] http://localhost:4500/sign -o project1_signed.exe --fail || echo failed
@wqweto
wqweto / mdAES.bas
Last active May 31, 2024 11:40
Pure VB6 impl of AES in CBC, CTR, GCM, CCM, EAX and OCB 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