<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Paul Harker on Medium]]></title>
        <description><![CDATA[Stories by Paul Harker on Medium]]></description>
        <link>https://medium.com/@Harxy?source=rss-4d385be4c294------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*LEU1AoajtBixe-uuMQrSjQ.png</url>
            <title>Stories by Paul Harker on Medium</title>
            <link>https://medium.com/@Harxy?source=rss-4d385be4c294------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 25 Nov 2026 00:48:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Harxy/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Vim Part 2: Tweaking your experience]]></title>
            <link>https://tech.sh24.org.uk/vim-part-2-tweaking-your-experience-df1b5131215d?source=rss-4d385be4c294------2</link>
            <guid isPermaLink="false">https://medium.com/p/df1b5131215d</guid>
            <category><![CDATA[vim]]></category>
            <category><![CDATA[text]]></category>
            <category><![CDATA[text-editor]]></category>
            <category><![CDATA[vi]]></category>
            <category><![CDATA[neovim]]></category>
            <dc:creator><![CDATA[Paul Harker]]></dc:creator>
            <pubDate>Wed, 26 Jul 2023 09:28:20 GMT</pubDate>
            <atom:updated>2023-07-26T09:28:20.559Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*1JDudm-Fqge8TQZ__pabcw.png" /><figcaption>Vim: too powerful to be contained in one blogpost.</figcaption></figure><p>A few months ago I wrote an article about <a href="https://tech.sh24.org.uk/vim-a-guide-for-getting-comfortable-part-1-4c17b182a640">getting started with Vim</a>, and it’s the part 1 to <em>this</em> article. At this point in a blog, the writer often says something like “please go and read the first part… <em>I’ll wait!</em>” in a very clever subversion of the reader/writer relationship.</p><p>But in this case, there is no need to read the first part if you don’t want to; it’s essentially just an autobiographic look at how I personally discovered Vim. I mean, if you want to, it’s a treat, but all you need to enjoy <em>this</em> article is a grounding in the fundamentals of Vim, and a desire to tinker with its defaults.</p><p>Because, I should warn you: this <em>is</em> tinkering, maybe unnecessarily. For me, all the things I’m about to talk about improved the experience of Vim, made it easier to get started and get productive. You could easily find Vim experts to disagree with everything I’ve written here. So my advice: think about each of these. Try to understand why I’ve tinkered in this way, whether my argument makes sense, and if it could help you too.</p><p>Also, a note about plugins — I do use them, plenty of them, but I’m not going to talk about any of them here. This blog is for changes that can be implemented purely within your vimrc or init.vim or init.lua if you’re fancy. I’ll show all remaps in both vimscript and lua.</p><h3>Leaders</h3><p>I think you should change your leader key to , (comma). I had it as space for a while, and you feel pretty badass, but I’ve come to decide that overloading the space key is rarely a good idea. You do you, though. I can’t actually remember what the default is at this point.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/327/1*JDWKhth-jCB_cFpLtVgpSw.png" /><figcaption>Set your leaders</figcaption></figure><h4>Dangers/alternatives</h4><p>I’ve been trying to get super fast with my Vim motions recently, and technically — and unfortunately — when you are using F to search for a character right-to-left, the repeat key for that action is mapped to ,. So I may change my leader, but I haven’t made the jump yet. I don’t character search backwards that much, yet.</p><h3>Quick New Splits</h3><p>I have a wide monitor, and I like to vertical-split up the wazoo. I also like to automatically move into any new split because, if you’re not going to use it, why would you open it. Map all this to &lt;Leader&gt;v and you’re laughing all the way to the vim-bank. And you can keep the vim-change! I’m not sure what I’m talking about here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*y1rXmZy9_tzBGP-RqsFT6A.png" /><figcaption>Quicksplits</figcaption></figure><h3>Quick Save</h3><p>I’ve recently hit upon the idea of having &lt;Leader&gt;&lt;Leader&gt; as save. It’s good.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*t6Z0W_N59F3acc5ZJphgog.png" /><figcaption>Quicksave</figcaption></figure><h4>Dangers/alternatives</h4><p>Some people like <em>save-when-exiting-insert-mode</em> but I feel like that really doesn’t play well with having an LSP <em>format-on-save</em>, as often it runs the linter when you haven’t finished making a change. This can even get you into circular situations where it is impossible to make a change without a zealous linter changing it back before you’ve finished.</p><h3>Visual line mode, always</h3><p>I don’t know about you (you never call anymore), but I find the line variant of visual mode much more useful than the standard cursor variant. When I’m using visual mode, 80% of the time I’m manipulating lines, not characters. So I’ve always switched my v key to go into line mode (traditionally V) and vice versa. I just find it handy, particularly for selecting blocks of code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/289/1*amHgttgHgcx_Qvl6pihAfQ.png" /><figcaption>Vicey Versa</figcaption></figure><h3>Quick Jump</h3><p><em>Thou shalt not press and hold j or k to move the cursor up and down.</em></p><p>Yes, we all know the dictum passed down by our forebearers, and it’s good advice too. But, we all do it. Well, ok, maybe not Ben Orenstein or Gary Bernhardt, but everyone else. Anyway, I know there is ctrl-d and ctrl-u for this kinda thing, but honestly, using a capital J and a capital K is just so easy. So, behold, they skip 25 lines.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/317/1*ArVVHYzOnkF-oZQfEIRdzA.png" /><figcaption>Quickjump</figcaption></figure><p>I’m sorry, but I use this all the time. If you want to stop reading here, I understand. But don’t, because I have something even better below!</p><h4>Dangers/alternatives</h4><p>Capital J is already used for something! Joining the next line with the current line, and that’s often useful. I remap it to &lt;Leader&gt;j:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/357/1*2bNU6tQ1aMOju4dRXFUqIQ.png" /><figcaption>For when you simply must join.</figcaption></figure><h3>Quicker Jump</h3><p>This is killer, for me.</p><p>Quick story: I used to swear by relative line numbers. You know, numbers that go up and down from 1 in both directions, demonstrated below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/46/1*YFczDekS38vbcascTmyYxA.png" /><figcaption>Line 50, relative line numbers</figcaption></figure><p>This does work great for many situations, but fails in one of the most important: pairing. Someone watching you work will often want to communicate a specific line, resulting in: y<em>ep, 12 lines up, oh 10… 9… no… yeah, there. </em>Unpleasant.</p><p>But, maybe more importantly, relative line numbers run a little counter to the Vim aesthetic. They are clunky and not <em>pure</em>, in the functional sense. A line number should be a consistent unchanging fact.</p><p>I gave the problem some thought and — prepare my trumpet, for I am about to toot it — I think it might be the one thing in this article that is truly <em>mine</em>, i.e. I didn’t steal from someone else’s dot-files and haven’t even seen it anywhere else I don’t think. Ready?</p><p>I map enter in normal mode to gg. Visual mode too. It looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*6BdO2_ZvifHi11_7pqPYQw.png" /><figcaption>Chef’s kiss</figcaption></figure><p>How does it work? As you may know, in vanilla Vim you can jump to any line by typing a number followed by gg, for example 23gg will jump to line 23. So this keymap means that typing 23 and then pressing enter will take you to line 23! Amazing. And it works in visual mode too! So now, when I want to copy a block of text, I hit v (see the visual mode trick, above) and then the line number of the end of the block, hit enter and the block is nicely selected for me.</p><h4>Dangers/alternatives</h4><p>There is one little issue with this and that’s quickfix windows. If you are a big user of quickfix windows, then you will need to map another key (I use spacebar) to <em>select file and close quickfix window</em>, which is usually mapped to enter. Or you can use a quickfix plugin, but I’m not talking about plugins here.</p><h3>Jumping between splits</h3><p>There are a number of ways that people like to jump between splits - my personal favourite is to use the numbers (1 on the far left, working across). I don’t often have more than 3 splits open, so for convenience, I map these to ctrl-y, ctrl-u and ctrl-i.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/1*-JdT81KJ65cdQKdNNtU-iQ.png" /><figcaption>You’ll have to figure out the vimscript to these ones on your own.</figcaption></figure><h4>Dangers/alternatives</h4><p>I’m sure ctrl-y , ctrl-u and ctrl-i each do super useful vim commands, and some person reading this will be all like “I use ctrl-y every day, you buffoon”. I know ctrl-u is the scroll-up command, for instance, but I remapped that above to K. I don’t use ‘em, so I use ‘em for this.</p><h3>Banishing c to the blackhole</h3><p>I’ve thought long and hard about it, and I haven’t yet found a situation where you would want to keep what was deleted by using c or C(as in ci( or <em>change within brackets</em>). Why would you want that in the copy register? If there is a use-case, I would argue it’s <em>rare</em>, and it’s much more likely that you have something in the copy register already that you want to put in the deleted text’s place. Which would be overwritten by the ced text into the register. No thank you!</p><p>What I do is change the c (and C) command to put that text into the blackhole register.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*NxvXtstWFYT_kN6H1Ys92g.png" /><figcaption>Now you C it, now you don’t.</figcaption></figure><h4>Dangers/alternatives</h4><p>Recently I’ve been using v a lot more to select and change text (i.e. vi(p , or <em>visual mode, select in brackets, paste)</em>. It does the same thing without having to mess around with your vimrc but it is one key more, and I still can’t think of a reason you’d want your changed value in your register.</p><h3>Supercharged refactoring with multi-text change</h3><p>This is one of the few vim-tweaks I have <em>objectively stolen</em> from someone, and I even remember where I got it. It’s the one, the only, <a href="https://www.youtube.com/channel/UC8ENHE5xdFSwx71u3fDH5Xw">thePrimeagen</a>, who gave this little bit of magic to the world (actually, I seem to remember him saying that he got it from someone else, but I’m not going to do recursive research for attribution).</p><p>This is just amazing and has to be seen to be believed. Let’s say in the below text I want to change the word count to the word variable throughout the file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*YNf8mGkSWv2KwXsWRF63Dw.gif" /><figcaption>VS Code can do that out of the box, you say? No one cares.</figcaption></figure><p>In my Vim setup, I just press &lt;Leader&gt;s on the word count, and <em>kablammo</em>, type in variable and watch the magic happen.</p><p>Here’s the magic in Lua, sorry I’m not figuring it out in vimscript:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*V_9lBffzaSZV9gt9BjUZiQ.png" /><figcaption>Yeah I don’t know either, just copy it and use it.</figcaption></figure><h4>Dangers/alternatives</h4><p>There are none, this is perfection.</p><h3>The end?</h3><p>Thanks for reading! That’s all we have time for today, this blog is already far too long. Part 3? Sure, why not! I think it will be about plugins. See you then.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df1b5131215d" width="1" height="1" alt=""><hr><p><a href="https://tech.sh24.org.uk/vim-part-2-tweaking-your-experience-df1b5131215d">Vim Part 2: Tweaking your experience</a> was originally published in <a href="https://tech.sh24.org.uk/">SH:24 Product &amp; Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vim: A guide for getting comfortable — Part 1]]></title>
            <link>https://tech.sh24.org.uk/vim-a-guide-for-getting-comfortable-part-1-4c17b182a640?source=rss-4d385be4c294------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c17b182a640</guid>
            <category><![CDATA[computing]]></category>
            <category><![CDATA[vim]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[healthcare]]></category>
            <dc:creator><![CDATA[Paul Harker]]></dc:creator>
            <pubDate>Thu, 03 Nov 2022 17:23:51 GMT</pubDate>
            <atom:updated>2022-11-04T09:57:46.327Z</atom:updated>
            <content:encoded><![CDATA[<h3>Vim: A guide for getting comfortable — Part 1</h3><p><em>This is the first part in a series on getting up and going with the text editor, Vim. Part 2 and beyond will primarily focus on configuration and making the Vim experience more comfortable as you progress through your journey. This part, cunningly titled Part 1, is simply an introduction to the wonderful world of Vim.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*0n3ezMj7dnMu3tNj" /></figure><p>I remember when I was just getting started learning to code.</p><p>I was in a Ruby bootcamp called Maker’s Academy. My opinions and hot takes on <em>that</em> experience could fill many blog posts on their own but, overall: positive, because hey, against all the odds, here I am, I can code. But one memory from that course that has stuck with me for 5 years (and counting) is only coding-adjacent. It was when an instructor started editing text in the terminal.</p><p>As good boys and girls, prior to the beginning of the course, we’d all done our two-week warm up: a set of tasks that meant we were ready to start flying on that first day. Get a little familiar with git and GitHub, play around with some Ruby data structures… but before all that, download a text editor.</p><p>At the time, we were sort of pushed towards Atom or Sublime text. VS Code was around, but not in the free wiz-bang lightweight state it is now. So, essentially, we all had Atom. It was a neat bit of kit. I’d slowly got the hang of having the code on the left, the tests on the right, and was immensely proud that I could flick between the two with a shortcut! Of course, you usually had to grab the mouse anyway, because it was unlikely the cursor was in exactly the right place when it arrived at the adjacent file. But it was still very cool.</p><p>Record-scratch, back to this instructor. He was demonstrating something, I can’t remember what, but a student had submitted some code, and he was running it in the terminal. You know, ruby fizzbuzz.rb or whatever. And it wasn&#39;t working. I assumed it was off to Atom to check where it was going wrong.</p><h3>First encounter</h3><p>But oh no. The instructor didn’t Cmd-tab to Atom. Instead he typed something: vim fizzbuzz.rb.</p><p>To me, with zero experience, what he did next looked like magic. He <em>flew</em> around the text, editing methods literally quicker than my eye could keep up. With a button press, he opened the tests in a split, made another quick change, then <em>ran the goddam tests without leaving the editor</em>. And of course, without touching the mouse.</p><p>After the session, I approached and asked him what was going on. How was what I’d seen possible? He knew me pretty well by this point, and he said these words: “It’s called Vim. Honestly Paul, I don’t think you’re enough of a masochist to learn Vim.”</p><p>Maybe he didn’t know me <em>that</em> well.</p><p>Now, I don’t think you have to be a masochist to learn Vim. I think you have to be determined, find joy in near-endless tweaking, and be able to derive satisfaction from glacial but constant improvement. In short, you have to really <em>want</em> to learn it.</p><h3>Never heard of Vim? Three links that might help</h3><p>I’m not going to talk too much here about the process of ‘getting started’ with Vim. That’s covered in many, many other places. In short though, three things helped a great deal:</p><ul><li><a href="https://vim-adventures.com/"><strong>Learn VIM while playing a game — VIM Adventures</strong></a> Don’t do this too much. Just do the free levels. It’s nice because it warms up your muscle memory, and introduces concepts, but really, unless you really respond to being taught things in game form, you should move on to real world examples, like:</li><li><strong>Vim Tutor</strong> This is the baked-in Vim learning tool. If you have Vim installed, just type vimtutor into the terminal and you’re away. It&#39;s great, do it all twice.</li><li><strong>Use Vim for everything for a while.</strong> Emails, documents, todo lists, all note taking, and obviously all coding. Just live in it for a couple of weeks. I had a scratch.txt file that I basically did everything in. It’s a long and hard process, but I promise, in about a month (maybe two) you’ll hate editing text in anything that <em>doesn’t</em> have vim keybindings. I can almost guarantee it.</li></ul><p>That’s it for this short introduction. In Part 2 (and beyond) I’m going to assume a bit more knowledge about how Vim works; it will be aimed at the advanced beginner. So, get your hjkl muscle memory ramped up and I&#39;ll see you next time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c17b182a640" width="1" height="1" alt=""><hr><p><a href="https://tech.sh24.org.uk/vim-a-guide-for-getting-comfortable-part-1-4c17b182a640">Vim: A guide for getting comfortable — Part 1</a> was originally published in <a href="https://tech.sh24.org.uk/">SH:24 Product &amp; Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Typing is the core of using a computer well]]></title>
            <link>https://medium.com/@Harxy/before-you-do-anything-with-a-computer-learn-to-type-557506b6b22d?source=rss-4d385be4c294------2</link>
            <guid isPermaLink="false">https://medium.com/p/557506b6b22d</guid>
            <category><![CDATA[typing]]></category>
            <category><![CDATA[creativity]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Paul Harker]]></dc:creator>
            <pubDate>Mon, 14 Mar 2016 11:43:40 GMT</pubDate>
            <atom:updated>2016-03-14T19:59:40.721Z</atom:updated>
            <content:encoded><![CDATA[<p>I don’t know what to do with Medium, it’s confusing, so I’m going to ignore all the scariness and then when I have an idea, type it and click publish.</p><p>And the great thing is, I can type about 70 wpm now. Which, if you look it up, isn’t world-record breaking. In fact, a harsh observer would call it average. But what harsh observer doesn’t understand is that only 6 months ago I would have struggled to get to 30 wpm. In fact, I know for sure, because for some reason I recorded it. I was puttering along at about 27.</p><p>So before I give a few intensely obvious tips on improving your typing speed, a thesis: before you start any project, be it learning to code, writing a novel or becoming a food blogger, learn to type quickly and accurately. After that, everything becomes easier.</p><p>It’s pretty obvious that your brain works quicker than your hands can move — that’s as true now as it was when I could type at 27 wpm, and is probably true of those incredible humans that hover around 150 wpm and more. But doing something remotely creative (yes, of course coding is creative) requires a feedback loop of motivation, satisfaction and focus, a groove that is far easier to cultivate if your thoughts are interrupted as little as possible.</p><p>It just makes everything — easier. There are fewer obstructions between what you want to do and doing it. You can refine quicker, get to the editing/refactoring stage quicker, make progress quicker, feel good about what you’re doing quicker.</p><p>One of the biggest steps for me was getting my beautiful mechanical Das Keyboard without letters on the keys. I’ve been touch typing for years but the muscle memory that had built up was just for strings of letters; when I’d written a ‘t’, for instance, my fingers could quickly find the ‘h’ because it’s such a common pairing of letters. Trying to do the alphabet in order proved much harder. Not looking at the keyboard when doing shortcuts was nearly impossible.</p><p>The Das Keyboard changed that. I couldn’t look at the keyboard for anything. Even the cmd key was unmarked. I actually had to learn, properly, where everything was. This lead to me using the correct fingers for the keys; the only way I could type a ‘[]’ accurately is if I had consistency in which finger I used (little finger, right hand, of course).</p><p>I can’t recommend the Das Keyboard highly enough. It’s a pricey bit of kit but it’s quality, will last you for years, and, imho, will improve your typing unrecognisably.</p><p>I also did a lot of gtypist, because it’s free, built into the terminal and doesn’t require an internet connection, so I could do it on the bus. Doing 20 minutes a day soon paid dividends.</p><p>But most importantly of all, Das Keyboard or not, just never look at the damn thing. Ever. Not for shortcuts, not for numbers, not for finding that elusive percentage sign. Learn which finger should type it, and reinforce it every day.</p><p>It’s my aim to get up to 100 wpm by the end of this year — and finally beat my girlfriend’s ridiculous typing speed from a misspent youth of MSN messenger. I’ll let you know how I get on.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=557506b6b22d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Socrates explains hashes, salts and why you should have a good password]]></title>
            <link>https://medium.com/@Harxy/socrates-explains-hashes-salts-and-why-you-should-have-a-good-password-53a5a9fee80a?source=rss-4d385be4c294------2</link>
            <guid isPermaLink="false">https://medium.com/p/53a5a9fee80a</guid>
            <category><![CDATA[hash]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Paul Harker]]></dc:creator>
            <pubDate>Tue, 07 Jul 2015 07:20:42 GMT</pubDate>
            <atom:updated>2015-08-10T08:56:57.735Z</atom:updated>
            <content:encoded><![CDATA[<p><em>In a recently discovered and little-known symposium, Socrates takes his followers through data security in the internet age. Of course, Plato was taking notes, the little creep. His minutes are replicated here exactly.</em></p><p>Socrates: Young fellows, do settle. Please, I have a lot to impart today. I don’t have time to hang around listening to you lot blather about love and hermaphrodites all day.</p><p>Young fellow: You’re not going to do that thing you do where you ask us questions and expect the truth of things to sort of emerge, like a test-driven conversation, are you?</p><p>Socrates: What do <strong>you</strong> think I’m going to do?</p><p>Young fellow: *sigh*</p><p>Socrates: So, what do we know about passwords? What is a password? Why do we have them?</p><p>Young fellow 2: We use them to keep undesirables out of our data. Without passwords, the world would be in chaos. Credit-card information and sexts would flow like regurgitated wine in the Vomitorium.</p><p>Socrates: What have you been doing in the entrance or exit passage to my amphitheatre? And isn’t that the Romans?</p><p>Young Fellow 2: Which ones are we again?</p><p>Socrates: Anyway, you’re quite right. Passwords need to be stored on the server-side, obviously, because they need to be validated when someone tries to sign in to your service. What problem does this give developers?</p><p>Young Fellow 3: All sorts of problems. For one they need to send the password to the server over http, which isn’t all that secure. Secondly, they need to store someone’s password, someone’s life, in their hands. If some deviant with nothing better to do (or noble warrior intent on data equality and freedom of information, depending on your point of view) manages to disaquire a database of its data, well… there’d be hell to pay. Especially as 83% of people only use one password for most of their accounts.</p><p>Socrates: Aside from the dubious statistic, bang on.</p><p>Plato: I love you Socrates.</p><p>Socrates: Quiet, Plato. So how do you send something that you don’t want other people to read during the sending?</p><p>Cautious Fellow: A… code?</p><p>Socrates: Precisely, my cautious fellow. A code. In fact, a very special type of code called a hash. How secure should the hash be?</p><p>All: Very secure.</p><p>Socrates: How long should it take someone, a bad person with a good computer, to determine what the password is from this hash?</p><p>All: Many years</p><p>Plato [just after the others]: Many years, Socrates.</p><p>Socrates: No! Never. That’s the answer. There should be no physical possible way that anyone can determine what the password was from your hash.</p><p>Young Fellow 1: What do you mean? Doesn’t that mean the hash is just a meaningless string of characters, alphanumeric or otherwise?</p><p>Socrates: Not at all…</p><p>Clever young fellow: So… you mean… that the same password would produce the same hash… even though there is no earthly way to determine the password from the hash?</p><p>Socrates: Exactly, you clever young fellow.</p><p>All other fellows: Impossible! Witch craft! What nonsense! etc!</p><p>Socrates: Now calm down.</p><p>Plato: I’m calm, Socrates.</p><p>Socrates: We already know that this kind of thing is possible. Think of modulus… or, in English, which we seem to be speaking, remainders. Plato, what’s the remainder of 16 divided by 3?</p><p>Plato: Two, Socrates.</p><p>Socrates: Nice try, but it’s one. So we know that 16 divided by 3 gives us a remainder of 1. Clever fellow, if I gave you a remainder of 3, what two numbers had been divided together to leave that remainder?</p><p>Clever young fellow: Errr… I… it could be… 19 divided by 4.</p><p>Socrates: Good effort! But the truth is you don’t have a clue what two numbers might have been used to make that remainder. It could be an infinite combination of numbers. So that is an example of modulus logic, one of the techniques used in creating the hashes.</p><p>The amazing thing about hashes is that although there is no way to get back to the password, a password can still be verified against an existing hash, because a password will always return the same hash, regardless of how complicated it is. But this does lead to one problem; can anyone see it?</p><p>Another clever fellow: Well, I suppose it’s to do with that last fact. Passwords always return the same hash. So if you had access to a huge database, a million or more users, then you could search for a hash string that is present many times. The users of that hash probably have a very common password: ‘password’ or ‘qwerty12345’. So it wouldn’t cause too much difficulty to get access to at least a few of your users.</p><p>Socrates: Exactly! When your IT Admin is telling you to have a slightly rarer password, he or she is not just doing it so that people can’t ‘guess’ your password — although with brute forcing techniques, that is a risk. They’re doing it so that some hash doesn’t stick out from their database like a bald head to one of those birds that drop tortoises to break their shells.</p><p>Aeschylus: What?</p><p>Socrates: Nothing, don’t worry. But this ‘similar hash’ problem isn’t as big as you might think, for as usual, someone clever has figured out a solution. And they’re called Salts. Anyone care to guess what a Salt might do?</p><p>Fellow x-1: Is it something that somehow makes each hash unique?</p><p>Socrates: Well, I guess if you say something incredibly vague it does increase your chances of being half-right. So yes, that’s basically correct. A salt is stored alongside a user ID, and is just a string of random characters. The database always knows that this string of characters is associated with that user, so when it sets up the user’s hash, it adds this Salt to the beginning. This makes a totally unique hash (to a significant level of probability) and can still be verified with any entered password at log-in by adding the Salt and turning the resulting string to a hash. This will exactly match the hashed n’ salted password stored in the database. Voila! I mean, Eureka.</p><p>Fellow x: So, developers need to think about this whenever they create a sign up and password database?</p><p>Socrates: Well, they should always be aware of security issues, but because it’s so common and it’s on the internet, people have made it easier with platforms and plugins. I use BCrypt.</p><p>Fellows: Thanks Socrates. This is all useful information. Hope we don’t have to wait too long for the internet to be invented and all this to come in useful.</p><p>Socrates: Indeed.</p><p>[Socrates flies away on silk’d wings. He’s so manly.]</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=53a5a9fee80a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>