Skip to content

Instantly share code, notes, and snippets.

View Meldiron's full-sized avatar
🔥

Matej Bačo Meldiron

🔥
View GitHub Profile
@Meldiron
Meldiron / scrypt-modified.md
Created June 17, 2022 09:11
What is Scrypt Modified? 🤔

Scrypt is a hashing algorithm first published in 2009 to address the security of passwords stored in a database. Generating such a hash is computationally intensive, meaning it takes a "long" time to generate a hash. This is fast enough for the sign-in process but makes it extremely costly to attempt brute-force to crack an existing password's hash.

SCrypt Modified is a fork of this algorithm. From its documentation, the intentions of the fork are unclear.

While official SCrypt takes password and salt to generate the hash, modified has a few additional steps:

  1. Generate derivedKey by creating a Scrypt hash where password is utf8-encoded, and salt is base64-decoded salt + base64-decoded salt separator
  2. Generate hash by encrypting base64-decoded signerKey with aes-256-ctr where key is the first 32 characters of derivedKey, while using an empty initialization vector of length 16
  3. Final hash must be base64-encoded
@Meldiron
Meldiron / backup.sh
Last active June 18, 2024 15:21
Backup and Restore Appwrite, the lazy way 🐌
# Make sure to stop Appwrite before this backup,
# and make sure you have enough space on the machine.
# After backing up, make sure there is a file in 'backups/backup-___.tar.gz'.
# Also please check size of this file, it should be at least 5kb, even for small instances.
docker run --rm \
-v appwrite_appwrite-mariadb:/backup/appwrite-mariadb \
-v appwrite_appwrite-redis:/backup/appwrite-redis \
-v appwrite_appwrite-cache:/backup/appwrite-cache \
@ourmaninamsterdam
ourmaninamsterdam / LICENSE
Last active April 24, 2024 18:56
Arrayzing - The JavaScript array cheatsheet
The MIT License (MIT)
Copyright (c) 2015 Justin Perry
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
@vkobel
vkobel / underscoreCase.cs
Created August 7, 2014 14:22
Simple C# extension method to convert a camel case string to underscore notation without any regex
public static class ExtensionMethods {
public static string ToUnderscoreCase(this string str) {
return string.Concat(str.Select((x, i) => i > 0 && char.IsUpper(x) ? "_" + x.ToString() : x.ToString())).ToLower();
}
}