Skip to content

Instantly share code, notes, and snippets.

View tdadadavid's full-sized avatar
🫅
Work of Art🧑‍🎨✌️

David Dada tdadadavid

🫅
Work of Art🧑‍🎨✌️
View GitHub Profile
@tdadadavid
tdadadavid / leaking_password.md
Last active January 27, 2026 18:53
Leaking password solution

A database with user passwords was leaked. The passwords were stored securely using hashing and salting. Specifically, each password was hashed using the SHA-256 algorithm in the following way:

sha256(user_password || SALT)

Here, SALT is a string that is appended to the user password before hashing. Unfortunately, the SALT was also leaked along with the hashed passwords.

Given the following information:

@tdadadavid
tdadadavid / trie.go
Created January 19, 2026 09:59
Revising Tries
package main
import (
"encoding/json"
"fmt"
)
func main() {
t := NewTrie()
t.Insert("name")
@tdadadavid
tdadadavid / plusone.go
Last active January 2, 2026 01:25
leetcode day 1
func plusOne(digits []int) []int {
// access array in reverse order.
for i := len(digits)-1; i >= 0; i-- {
if digits[i] != 9 {
digits[i] = digits[i]+1
return digits
} else if i > 0 && digits[i] == 9 {
digits[i] = 0
} else {
digits[i] = 1
@tdadadavid
tdadadavid / bus.go
Last active January 1, 2026 13:13
POC EventBus
package eventstore
import (
"errors"
"fmt"
"log/slog"
"sync"
"time"
)
@tdadadavid
tdadadavid / Caddyfile
Created December 22, 2025 04:09 — forked from SkYNewZ/Caddyfile
Example Caddyfile for using as load balancer
{
# Enable Debug mode
debug
# Disable admin API
admin off
}
localhost {
# https://caddyserver.com/docs/caddyfile/directives/push