From a8afc7cb94b5ffea7cdabdc42ef1df3314770e02 Mon Sep 17 00:00:00 2001 From: "Haoran S. Diao" <0@hairydiode.xyz> Date: Mon, 11 Feb 2019 18:29:50 -0500 Subject: initial commit --- README | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++ mshimark/Makefile | 4 +++ mshimark/mkshimark | Bin 0 -> 17000 bytes mshimark/mkshimark.c | 29 ++++++++++++++++++++ 4 files changed, 108 insertions(+) create mode 100644 README create mode 100644 mshimark/Makefile create mode 100755 mshimark/mkshimark create mode 100644 mshimark/mkshimark.c diff --git a/README b/README new file mode 100644 index 0000000..25a898c --- /dev/null +++ b/README @@ -0,0 +1,75 @@ +Shimarks are icons generated from the hash of urls and their domains for the +purpose of preventing phishing. The justification is that it is unlikely for an +attacker to be able to create a phishing domain or url that also produces a hash +collision. + +There are two types of Shimarks, Domain Shimarks, which are generated from only +the domain of the URL, displayed on the left side of URLs; and URL +Shimarks, which are generated from the entire URL, displayed on the right side +of the URL. + +1. Shimarks rely on MD5 hashes. This hash function has been chosen because of +its ubiquity. Although collision attacks have been discovered for MD5, the +relatively short length of URLs and domain names makes it less likely that an +attacker can hide a collision block within a URL. Nonetheless, I am taking +suggestions for a better hash function to use. + +2. Shimarks are black and white only, so that they may easily be used in print +and so that they are accesible to the colorblind. + +3. Shimarks are 16x16 pixels by default, which allows for 256 bits of +information. Since md5 produces 128 bits, this is then mirrored either +horizontally or vertically depending on the 1st bit of the hash. This mirroring +will hopefully make Shimarks more identifiable. + + Therefore, if the bit at 0x00 is 0, then the layout of the ShiMark is: + + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F + 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F + 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F + 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F + 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F + 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F + 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F + + Where every two bytes are layed out horizontally and to produce half the + pattern. This is then flipped across the horizontal axis. + + Otherwise, it is flipped across the vertical axis: + + 00 10 20 30 40 50 60 70 70 60 50 40 30 20 10 00 + 01 11 21 31 41 51 61 71 71 61 51 41 31 21 11 11 + 02 12 22 32 42 52 62 72 72 62 52 42 32 22 12 22 + 03 13 23 33 43 53 63 73 73 63 53 43 33 23 13 33 + 04 14 24 34 44 54 64 74 74 64 54 44 34 24 14 44 + 05 15 25 35 45 55 65 75 75 65 55 45 35 25 15 55 + 06 16 26 36 46 56 66 76 76 66 56 46 36 26 16 66 + 07 17 27 37 47 57 67 77 77 67 57 47 37 27 17 77 + 08 18 28 38 48 58 68 78 78 68 58 48 38 28 18 88 + 09 19 29 39 49 59 69 79 79 69 59 49 39 29 19 99 + 0A 1A 2A 3A 4A 5A 6A 7A 7A 6A 5A 4A 3A 2A 1A AA + 0B 1B 2B 3B 4B 5B 6B 7B 7B 6B 5B 4B 3B 2B 1B BB + 0C 1C 2C 3C 4C 5C 6C 7C 7C 6C 5C 4C 3C 2C 1C CC + 0D 1D 2D 3D 4D 5D 6D 7D 7D 6D 5D 4D 3D 2D 1D DD + 0E 1E 2E 3E 4E 5E 6E 7E 7E 6E 5E 4E 3E 2E 1E EE + 0F 1F 2F 3F 4F 5F 6F 7F 7F 6F 5F 4F 3F 2F 1F FF + +4. For compatibility with text only mediums, Shimarks can be abbreviated by +taking the top left 6x4 pixels and representing them using braille. + + +Issues with the current specification: + 16x16 pixels at icon scale might be difficult to distinguish, therefore +a method for making the difference between hashes more distinctive(a la +identicons), or for using fewer bits, is needed. + + Overreliance on abbreviated Shimarks may make collision rates too high. diff --git a/mshimark/Makefile b/mshimark/Makefile new file mode 100644 index 0000000..806e1cd --- /dev/null +++ b/mshimark/Makefile @@ -0,0 +1,4 @@ +mkshimark: mkshimark.c + gcc mkshimark.c -lssl -lcrypto -o mkshimark +clean: + rm mkshimark diff --git a/mshimark/mkshimark b/mshimark/mkshimark new file mode 100755 index 0000000..be134b5 Binary files /dev/null and b/mshimark/mkshimark differ diff --git a/mshimark/mkshimark.c b/mshimark/mkshimark.c new file mode 100644 index 0000000..eb82e1b --- /dev/null +++ b/mshimark/mkshimark.c @@ -0,0 +1,29 @@ +#include +#include +#include +//32 characters +int main (int arc, char * argv[]) { + MD5_CTX c; + char md5buffer[512]; + int bytesread; + printf("Put something in the stdin of the program and it will generate a random block of text\n"); + unsigned char md5result[16]; + MD5_Init(&c); + do { + bytesread = fread(md5buffer, sizeof(char), 512, stdin); + if (bytesread < 0) { + printf("Error reading from STDIN\n"); + return -1; + } + MD5_Update(&c, md5buffer, bytesread); + } while (bytesread != 0); + MD5_Final(md5result, &c); + printf("\n"); + int i = 0; + while ( i < (16) ) { + printf("%.2x",md5result[i]); + i++; + } + printf("\n"); + return 0; +} -- cgit v1.1