Skip to content

Instantly share code, notes, and snippets.

Avatar

Marco Magdy marcomagdy

  • Amazon Web Services, Inc.
  • Seattle, WA
View GitHub Profile
View BTree.cpp
enum { BMAX = 32, BCUT = BMAX / 2, BHEIGHT = 6 };
typedef uint8_t BIndex;
struct BNode {
BIndex length;
Key keys[BMAX];
union {
BNode *children[BMAX];
Value values[BMAX];
@marcomagdy
marcomagdy / BTree.cpp
Created Apr 28, 2020 — forked from pervognsen/BTree.cpp
A B+-tree implementation with find, insert and delete in 176 lines of code.
View BTree.cpp
enum { BMAX = 32, BMIN = BMAX / 2, BHEIGHT = 6 };
struct BNode {
uint32_t length;
Key keys[BMAX];
union {
BNode *children[BMAX];
Value values[BMAX];
};
};
View gist:2197d6210568d3fff9efeb4b4c0dcc1d
### Keybase proof
I hereby claim:
* I am marcomagdy on github.
* I am marcomagdy (https://keybase.io/marcomagdy) on keybase.
* I have a public key ASD6MfgggMW_FzGtYQV-N2w5uhZxBEHNV2dALe4cLBObOQo
To claim this, I am signing this object:
@marcomagdy
marcomagdy / Google MFA
Last active Aug 29, 2015
Google MFA in C#
View Google MFA
class Program
{
static void Main(string[] args) {
var secretByets = Base32Encoding.ToBytes("supersecretpassword");
var input = GetEpoch() / 30;
var hmac = new HMACSHA1(secretByets);
var output = hmac.ComputeHash(toBytes(input));
Console.WriteLine("{0:d6}", calculate(output));
You can’t perform that action at this time.