• Exploring Obsured Code: Part -1

    This is an snippet I saved back in college. I’m not sure who the original author is for this. Let’s try to understand how this works

    // A decimal to binary convertor
    // All Credits to the original author
    (_$=($,_=[]+[])=>$?_$($>>+!![],($&+!![])+_):_)(255);
    
  • Node Module System

    Similar to the article I wrote about Lua module loaders, the same can be done in nodejs. We can override the require to be able to load custom extensions

    Wait a minute is there any practical use case other than a syntax hack?

    Well then how about we build a loader so nodejs can read yaml

    require("./loader")
    const config = require("config.yaml")
    const port = config.port || 3000;
    const http = require('http');
    
    const requestListener = function (req, res) {
      res.writeHead(200);
      res.end('Hello, World!');
    }
    
    const server = http.createServer(requestListener);
    server.listen(config.port);
    

    This looks way more practical so let’s begin.

    TLDR; Leaving a link to the source code I made for this example

  • Lua Module Loader

    What if I told you there is a way to extend the default syntax of Lua? In the below example I use @ as an alias for self, and fn as an alias of function. This and may more can be achived with the module loader in Lua

    -- myfile.lua
    local greet = fn(name)
      print('Hello ' .. name)
    end
    
    greet('mark1626')
    
    ---
    -- cube.lua
    Cube = {a = 1}
    
    function Cube:new(o)
      o = o or {}
      setmetatable(o, @)
      @.__index = @
      return o
    end
    
    function Cube:area()
      return @.a * @.a
    end
    
    return Cube
    
  • The Drunken Bishop

    Have you ever seen something similar to this??

    +----[RSA 2048]---+
    |        . o.+o  .|
    |     . + *  +o...|
    |      + * .. ... |
    |       o + .   . |
    |        S o   .  |
    |         o     . |
    |          .     o|
    |               .o|
    |               Eo|
    +------[MD5]------+
    

    Usually when we create a new SSH key there is an image printed at the last step and we mostly ignore it, this time I wanted to understand what this image meant.

    The image is a visualization of the fingerprint created with the Drunken Bishop Algorithm

  • Reverse Engineering Code Art - Part 6 - Noisy Donuts

    Based on this dwitter by Pascal

    
    c.width=w=70;for(i=2800;i--;)x.fillRect(X=i%w,Y=(i-X)/w,0<T(T(S(X/7+5*C(t))+S(Y/7-5*t))),1)
    
    

    Noisy Donuts