Use dynamic programming:
ans[i] = 0 # i < 4
ans[i] = ans[i - 1] + (i - 1) * (i - 1) // 4 - (i - (i // 2 + 1)) # i >= 4
#!/usr/bin/env python3 | |
from pwn import * | |
context.os = 'linux' | |
context.arch = 'amd64' | |
context.terminal = ['tmux', 'new-window'] | |
l = ELF('./libc-2.31.so') |
#!/usr/bin/env python3 | |
from pwn import * | |
context.os = 'linux' | |
context.arch = 'amd64' | |
context.terminal = ['tmux', 'sp', '-v', '-p', '90'] | |
b = ELF('./secret_keeper') | |
l = ELF('/lib/x86_64-linux-gnu/libc-2.31.so') |
#!/usr/bin/env python3 | |
from pwn import * | |
import ctypes | |
context.os = 'linux' | |
context.arch = 'amd64' | |
LIBC = ctypes.cdll.LoadLibrary('/lib/x86_64-linux-gnu/libc-2.27.so') |
class Hash { | |
public: | |
Hash(const std::string &s) : hash1(s.size() + 1), hash2(s.size() + 1) { | |
if (base == -1) { | |
base = genBase(minBase, mod); | |
pow1.push_back(1); | |
pow2.push_back(1); | |
} | |
while (pow1.size() <= s.size()) { |
// Source: https://github.com/vdisasm/ScyllaHideForIda7 | |
// Patch win32_user.dll | |
unsigned char pattern[6] = | |
{ | |
0x49, 0x83, 0xFB, 0x02, // cmp r11, 2 | |
0x72, 0x20 // jb +0x20 | |
}; | |
unsigned char JmpRel = 0xEB; |