• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Encrypting text into colors using Numberphile's method

UniqueUsername1

New Member
I was watching an old Numberphile video where he discusses this.

His method is to:
0) Select a text string to encrypt.
1) Convert each character into it's binary equivalent.
2) Combine the binary numbers to create a "binary string".
3) Convert the binary string into a decimal string.
4) Convert the decimal string into hexadecimal string.
5) Split the hex string into chunks of six characters. Add a "+" to the last chunk if it's length is less than six characters.
6) Convert each hex string into it's colour representation. Add the "+" chunk if required.
7) Voila.

I wanted to replicate this process in Excel. Here is my progress:
Firstly, a few steps are redundant as he used them to explain what he was doing.
I have attached the file I have worked on.

I am stumped with long strings of text. Any help will be appreciated.
 

Attachments

  • Colour Encryption.xlsx
    13.2 KB · Views: 9
I echo @6StringJazzer's comment, however, if it helps, in the attached are formulae; one in cell C4 which refers to cells to the left of it and cell B1, the other formula (which gives the same result) in cell E4 refers only to cell B1 and the row number that the formula itself is in (so you don't need columns A & B for this to work). These formulae may need to be committed to the sheet with Ctrl+Shift+Enter rather than with plain Enter depending on your version of Excel. Both formulae need to be copied down.
I've added a tiny macro (so no checks for errors), activated by clicking the button at cell B3 which colours the cells to the right of whichever cells are currently selected on the sheet using the hex code in those selected cells.
Examining the resulting colours seems to confirm matching colour hex codes:
78216

If you're using a version of Excel which has the SEQUENCE function I should be able to adjust the formula so that it will spill into as many rows as required for the length of the string in cell B1.
 

Attachments

  • Chandoo47785Colour Encryption.xlsm
    23.5 KB · Views: 14
I echo @6StringJazzer's comment, however, if it helps, in the attached are formulae; one in cell C4 which refers to cells to the left of it and cell B1, the other formula (which gives the same result) in cell E4 refers only to cell B1 and the row number that the formula itself is in (so you don't need columns A & B for this to work). These formulae may need to be committed to the sheet with Ctrl+Shift+Enter rather than with plain Enter depending on your version of Excel. Both formulae need to be copied down.
I've added a tiny macro (so no checks for errors), activated by clicking the button at cell B3 which colours the cells to the right of whichever cells are currently selected on the sheet using the hex code in those selected cells.
Examining the resulting colours seems to confirm matching colour hex codes:
View attachment 78216

If you're using a version of Excel which has the SEQUENCE function I should be able to adjust the formula so that it will spill into as many rows as required for the length of the string in cell B1.

Thank you! You went above and beyond what I was expecting as help.
To answer your and @6StringJazzer's question, all I had to do was drag the formula a few cells ahead.
I wanted to drown in my tears of embarrassment, but I thought I should thank you before doing that.
 
Back
Top