Lava lamp encryption

Lately there have been some articles on that 10% of the internet I protected by lava lamp encryption. Cloudflare have a wall of lava lamps that theire encryption take photos of to compute a more random password. Even though their encryption algorithms is most likely never going to run out of randomnes, they added a layer with total randomnes that is absolutley unpossible to predict. They take photos of a huge wall of lavalamps. Even if there is static/noise in the picture , thats bether. It helps to add even more randomnes.


I thought as a fun little weekend project i would look at how i could create a simplified proof of conecpt in PowerShell to generate a more random password that Get-Random is capable of.

First i needed something that could read picturefiles. Some time ago i came over a cool function/script from Prateek Singh called Write-Pixel. You can find it over at his awesome blog here. Its limited to 16 collors, but within that frame it finds the closest collor to each pixel in a picture. So what i did was instead of naming the colors likes this:


I used a random string generator to generate a random string with 200 characters for each of the collors. So it ended up like this:


After this i edited the script som i instead of outputting a blank space with background collor, it outputted the “collor” name/text to a variable. After the script is done analyzing the whole picture and have created a huge text/string. Ecspecialy if its a high res photo like 3000*2000 pixels. Thats 3 million pixels! I then run a command that selects 20 random characters from that 3 million * 200 character long string.

Now you have a bit more random password than what Get-Random can produce alone.

I dont say that this is extremely secure. Probbaly would have been better if the string/name of each collor was generated by some sort of algorithm or used Get-Random to select the text that was goign to be set for each collor.

I would sugest to test with a verry small picture, or else it will take a great deal of time to analyze the picture. I have added so the script outputs each collorcode so we can see some sort of progress. Probbaly would have run faster without the output.

$script:passwordstring = "1"
Function Write-Pixel

                $Path = 'C:\webcamphotos\WIN_20180106_19_42_31_Pro.jpg'
        [void] [System.Reflection.Assembly]::LoadWithPartialName("System.drawing")

        # Console Colors and their Hexadecimal values
        $Colors = @{
            'FF000000' =   '[email protected][email protected]!cigrI5lxPTeK!vZdLmKyin0msSF$qm86!UVVMkz6xTGQkCRYy4ULBqD8va9ZeNcb3ceJsU[email protected]S'
            'FF000080' =   '[email protected][email protected]S[email protected][email protected]$e$PFNMSm'
            'FF008000' =   'CeKD[email protected][email protected][email protected]!MDwYiuia61J9rbr!wj01pi0luSxF6iMTopyuaG8WFkgY7rzxnrtOu$mbzw8rgbBVuBUuO'
            'FF008080' =   '[email protected]@[email protected]s[email protected][email protected]$GI'
            'FF800000' =   '0fFtGyhr63uX1LOBDuX49bgRq1mbXVB4cll4nWYvyY!VDSC0EfNLkMgf[email protected][email protected]YEt$9n78PhlKWxkH'
            'FF800080' =   'W3cV$iPWJhwKNI8l[email protected][email protected][email protected]'
            'FF808000' =   'Nh6GLrZbSqbNir3WM4GZiwsU3lupPJhO$RG1x9YL0SQ6VEj$YKUy5HETo0JsoCVZjE[email protected][email protected][email protected]$'
            'FFC0C0C0' =   'ax$1Md0v5buwvzspjctSFDqQFlWPBQh08egQdbOug18NZqJQ$KkV[email protected][email protected]@[email protected]'
            'FF808080' =   'Tv1szp5wbq9WUJhSgaw6wmRqqMzouN$!p2OeB4tyd8R[email protected][email protected]@P9Ydru!OQtFETKsQ9CcBo$XsOo4V'
            'FF0000FF' =   'zqLMWjHXHTcBq!T6LEBYuo8fifqkhRFQ79llps94tyui9uceEKUm3FyMz1HsBoorcJYZFy$ABeKdN!3Kvxj85sRJ0vkR7vMMH!c1se3FEmfUjwxUMJ3b9vzxBEXkiE3Wg2eaNPQ44ETPtW4Bv78Ik$rBFE0F9ysQXT7L!dhBk4bKDwNo5cg4i6e8oB0a7TPUkmOmyMny'
            'FF00FF00' =   'R0M6FfUlX8[email protected]el9L86fNL8ZqTkDmhrVmrtwVsSGbws9lSxC!c5sKYNuYcigwMQBV4k$[email protected]8DCm87U'
            'FF00FFFF' =   '[email protected]!RqymlAj9icNwSrBlX7ENnvL[email protected][email protected]@xnSmic4HMV[email protected]'
            'FFFF0000' =   '[email protected][email protected][email protected][email protected][email protected]'
            'FFFF00FF' =   '[email protected]$HFxlHQvNP8b2u3Y8tPfBPlszhjLHEjVmgMAGitL[email protected][email protected][email protected]'
            'FFFFFF00' =   '[email protected][email protected]11tRPMxWHnntSnGNn0X3WMuMSJKDbDE8LbA7YSJVsCasrkILYmsvsdHypsEiRG!5zNcxxU3afAHg9qnwu9ewiRzAvw'
            'FFFFFFFF' =   '[email protected][email protected]@[email protected]@[email protected]$xPQQ0rmU6tzp4'

        # Algorithm to calculate closest Console color (Only 16) to a color of Pixel
        Function Get-ClosetConsoleColor($PixelColor)
            $Differences = Foreach($item in $Colors.Keys)
                ''|select @{n='Color';e={$Item}},@{n='Diff';e={[math]::abs([convert]::ToInt32($Item,16) - [convert]::ToInt32($PixelColor,16))}}

            ($Differences |sort Diff)[0].color
        Foreach($item in $Path)
            #Convert Image to BitMap
            $BitMap = [System.Drawing.Bitmap]::FromFile((Get-Item $Item).fullname)

            Foreach($y in (1..($BitMap.Height-1)))
                Foreach($x in (1..($BitMap.Width-1)))
                    $Pixel = $BitMap.GetPixel($X,$Y)
                    $BackGround = $Colors.Item((Get-ClosetConsoleColor $
                    $script:passwordstring += "$BackGround"






for ($i = 0; $i -lt 20; $i++ ) {
    $newpassword += $script:passwordstring[(Get-Random -Minimum 0 -Maximum $passwordstring.Length)]



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s