<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">Thanks for the links and ideas Mark,
<div><br>
</div>
<div>We did dictionaries and (a quick look at) hashes last semester since they are such a useful data structure it seemed a shame not to introduce them at the same time as the other basic structures. One task I gave the students was to read in a english dictionary
from a file and find how many hash collisions it generates using Python's standard hash. It is different every time you run it due to the salting.</div>
<div><br>
</div>
<div>This semester we started off with security and talking about the differences between quick hashes used for hash tables and cryptographic hashes used for storing passwords. Quite a few of my students are rolling their own login and password systems (not
a good idea in public facing code). The comparison between the two types of hashes ties into the exercise that you suggest.</div>
<div><br>
</div>
<div>A really interesting article about the standard hashes used by most languages is <a href="https://medium.freecodecamp.com/hash-table-attack-8e4371fc5261">The moment when you realize every server in the world is vulnerable</a>. It talks about a vulnerability
in web servers using hash tables that exploits cleverly generated hash collisions to overload a server. And how the standard fix of salting the hashes used by most languages is not enough to completely stop this exploit. The solution is to find a new compromise
point for the speed of the standard hash algorithms that makes the exploit impractical.</div>
<div><br>
</div>
<div>Simon</div>
<div><br>
</div>
<div>PS</div>
<div>I described linked lists to a couple of my more engaged students, and one of them responded with horror - "why would anyone want to do that?!" :)</div>
<div><br>
</div>
<div>---</div>
<div><br>
</div>
<div><span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; background-color: rgb(255, 255, 255);">Simon Tyler</span><br style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; background-color: rgb(255, 255, 255);">
<span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; background-color: rgb(255, 255, 255);">Classroom Teacher</span><br style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; background-color: rgb(255, 255, 255);">
<span style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 12.8px; background-color: rgb(255, 255, 255);">Footscray City College</span><br>
<div><br>
</div>
<div><br>
<div style="font-family:Times New Roman; color:#000000; font-size:16px">
<hr tabindex="-1">
<div id="divRpF878862" style="direction:ltr"><font face="Tahoma" size="2" color="#000000"><b>From:</b> sofdev-bounces@edulists.com.au [sofdev-bounces@edulists.com.au] on behalf of Mark [mark@vceit.com]<br>
<b>Sent:</b> Tuesday, 30 August 2016 1:16 PM<br>
<b>To:</b> Year 12 Software Development Teachers' Mailing List<br>
<b>Subject:</b> [Year 12 SofDev] Associative arrays<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">Hi, hash fans
<div><br>
</div>
<div>A couple of approachable explanations of hash functions, associative arrays and collisions can be found on Youtube. They would be good for your class' potential future hash users.</div>
<div><br>
</div>
<div>
<div><a href="https://www.youtube.com/watch?v=MfhjkfocRR0" target="_blank">https://www.youtube.com/watch?v=MfhjkfocRR0</a></div>
<div><a href="https://www.youtube.com/watch?v=h2d9b_nEzoA" target="_blank">https://www.youtube.com/watch?v=h2d9b_nEzoA</a></div>
<div><br>
</div>
<div>There are several others, BTW. Have a look around.</div>
<div><br>
</div>
<div><b>Linked lists</b> are not KK, but are often essential in solving collisions, and are good basic nutritious IT theory if you find the time.</div>
<div><br>
</div>
<div>Also, <b>sparse arrays</b> may become relevant as hash functions create huge hash values, requiring huge arrays that can accommodate huge hashed indexes. Sparse arrays are not key knowledge, but your stronger students might find them an interesting problem.</div>
<div><br>
</div>
<div>An interesting exercise is to get your kids to brainstorm hashing algorithms and choose the best one based on its speed, the number of collisions it will create, and the size of the necessary array will have to be. (Other criteria may also apply, e.g.
whether similar values generate similar hash codes.)</div>
<div><br>
</div>
<div>Some very basic starting points for algorithms:</div>
<div>- the length of the string (very easy to compute, many many collisions)</div>
<div>- the sum of the ASCII codes of each letter of the string. (but letter positioning loses value, so "cat" and "act" will generate the same hash value)</div>
<div>- as above, but each letter's ASCII code is multiplied by the letter's position in the string. This introduces information based on the position of text, not just its presence, so "cat" and "act" generate different hash codes. - hard to compute, very few
collisions, huge array needed.</div>
<div><br>
</div>
<div>- others?</div>
<div><br>
</div>
<div><br>
</div>
<div>Regards,</div>
<div>Mark</div>
-- <br>
<div class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div><i><br>
</i></div>
<div><span style="font-size:12.8px">Mark Kelly</span><br>
</div>
<div><br>
</div>
<div><a href="mailto:mark@vceit.com" style="font-size:12.8px" target="_blank">mark@vceit.com</a><br>
</div>
<div><a href="http://vceit.com" target="_blank">http://vceit.com</a></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
<table><tr><td bgcolor=#ffffff><font color=#000000><pre>IMPORTANT - This email and any attachments may be confidential. If received in error, please contact us and delete all copies. Before opening or using attachments check them for viruses and defects. Regardless of any loss, damage or consequence, whether caused by the negligence of the sender or not, resulting directly or indirectly from the use of any attached files our liability is limited to resupplying any affected attachments. Any representations or opinions expressed are those of the individual sender, and not necessarily those of the Department of Education and Training.</pre></font></td></tr></table>