Background

The unix crypt algorithm used a symmetric encryption algorithm to construct a hash. It did it by starting with a fixed string (i.e. the same every time) and encrypting it using the message/password as the key. The output was then re-encrypted with the same key. Then that output was re-encrypted with that same key, and so on. We will do the same thing, except that we shift the string various amounts prior to encrypting. This is needed because of the basic weakness of the Caesar and Vigenere ciphers.

Left shift of a string

If you have a string s0 s1 s2 ... sn-1, its left shift is s1 s2 ... sn-1 s0. Its shift left by k places is simply the result of k left shifts.
Examples:
                          str = abcdefghijk
            left shift of str = bcdefghijka

                          str = abcdefghijk
shift left by 3 places of str = defghijkabc
      

The Shift+encalg Hash

Assuming that you have an encryption algorithm encalg and a message/password pswd, here's how to compute the shift+ hash:
1. x = "GO_NAVY_2018^mid"  ← this 16 character string is called the "initialization vector"
2. for i from 0 up to 15 do
      c = character at index i in string x
      k = (ASCII value of c) mod 16
      shift x left by k places ← Note: x is modified!
      x = encryption of x with key pswd using algorithm encalg
3. return x as the hash value

A little bit of explanation (optional) and some useful debugging info

Although it's outside the scope of what you really need to know to do this project, it's interesting to see why we need to do things multiple times. One important property a cryptographic hash should have is that very similar passwords should lead to totally different hashes. In the table below, I've laid out the intermediate x-values printed out by shift+vigenere on two passwords that differ by only one letter. What we see is that the results are very similar in the first few rounds, but diverge as we go through more and more iterations.

hash algorithm: shift+vigenere
message/password: grumpy
hash algorithm: shift+vigenere
message/password: grompy
 before loop x = GO_NAVY_2018^mid
after i = 00 x = Kz*t-\Y`^9D]:8PK
after i = 01 x = 0T4*EI7qufsZEWX+
after i = 02 x = 1@1cjd_Q?IMzmK.m
after i = 03 x = Oa^QF=5Dt_@,Yy:t
after i = 04 x = r;nQ5*Ep4fD_JH@/
after i = 05 x = 0VD:5-^2hC*y1g.X
after i = 06 x = kO*H98ruXu]Agp+Y
after i = 07 x = uioJj[-^jnNi;rB+
after i = 08 x = :`5d7za`i<_YjUd`
after i = 09 x = VL^R/^r[1lV^U3YK
after i = 10 x = ^R+^K\A*S=KJJIzP
after i = 11 x = 7AD;oNJIvP@Z-rM/
after i = 12 x = ^Dzz6BxfH<>t<7Tp
after i = 13 x = R?60i:tKjP9xf-<j
after i = 14 x = Ru6\G=sxc,iIVG3j
after i = 15 x = U@P9yh>l0N<;_o]o
 before loop x = GO_NAVY_2018^mid
after i = 00 x = Kzut-\Y`X9D]:8JK
after i = 01 x = 0T.*?I7qifsZEWL+
after i = 02 x = 8suFty+@+c^d_Q9I
after i = 03 x = h7pUSbKH-;-qa=hk
after i = 04 x = AJV==+xueS2fW_+b
after i = 05 x = RNSnW?6M1/qva\Gu
after i = 06 x = sDvrftMS;gGL?eK1
after i = 07 x = ^]h?H9S>@1ZInj8h
after i = 08 x = JT\1=7?54tOGZa,Z
after i = 09 x = z.3xzr;>NSrX6KPt
after i = 10 x = pond0<:JfJ+I<knq
after i = 11 x = 6s=.`l]gc`Y.y1>X
after i = 12 x = LPskw<D-g/t^XT[U
after i = 13 x = c38p\-`ULFPS8Gg]
after i = 14 x = AC:BH63^QUy6\SrR
after i = 15 x = w9<yy\=LmyQQ^I55

Of course shift+clear is a terrible hash algorithm. Turns out shift+caesar isn't much good either ... after all, the password is mapped to a "shift character" and there are only 81 of those. However, shift+vigenere is actually not too bad. Certainly you should find that different passwords seem to give rise to totally different hashes regardless of how close the passwords are.

More Examples to Help With Debugging

hash algorithm: shift+vigenere
message/password: hotcakes
hash algorithm: shift+vigenere
message/password: hotcekes
 before loop x = GO_NAVY_2018^mid
after i = 00 x = LwzjoNWaQ;HG41@Q
after i = 01 x = NE40-ul8>@pbP_8O
after i = 02 x = kiequ0ZZ=S1745oy
after i = 03 x = VYj]gJD5@v0ml_cc
after i = 04 x = s4oiS\I[PJRRCW4<
after i = 05 x = 0K-uYuYa@PBC6:<J
after i = 06 x = =6<oq,4y8rnA[IK8
after i = 07 x = _b:C/;s5t0hYcuc0
after i = 08 x = m/lnZqRQPi\iERu;
after i = 09 x = VPb-8evem`gBWB;H
after i = 10 x = RaYOyG,35JIJdyOn
after i = 11 x = 6>]a5^<YFCr/ctpB
after i = 12 x = NzWu?6-jmWmXywyU
after i = 13 x = WaPU>iaqBBs?[/qv
after i = 14 x = NDNwOQ[:/g8Cfa`O
after i = 15 x = <B=6]?;Sxt`qzVKX
 before loop x = GO_NAVY_2018^mid
after i = 00 x = LwzjsNWaQ;HG81@Q
after i = 01 x = NE401yl8>@pbTc8O
after i = 02 x = omeqy0ZZAW1785oy
after i = 03 x = ZYjakJD9Dv0qp_cg
after i = 04 x = ^dXKQJCbN_C,t4`y
after i = 05 x = 0qmmJiH\E?J2-R8W
after i = 06 x = 23CkhBsOnefU4Y2T
after i = 07 x = Aw,+UX,k<b^N?uC*
after i = 08 x = ,i<c+ggtBLvSwRHF
after i = 09 x = dFA.gYw[i[`\,<`K
after i = 10 x = Q::gQIaSVOYDg,JC
after i = 11 x = >=Z;@?C<TqC+;*u_
after i = 12 x = i/t]I.xRy48+wD[;
after i = 13 x = 6sq:custd8TtSp^U
after i = 14 x = KI/[[*Mm`h]q>d=h
after i = 15 x = M\VYyTx`8=yCEk7e


hash algorithm: shift+caesar
message/password: hotcakes
hash algorithm: shift+vigenere
message/password: hotcekes
 before loop x = GO_NAVY_2018^mid
after i = 00 x = <`^_f;JFAu,<+o36
after i = 01 x = j=;<CixtoRZjYLad
after i = 02 x = G6z>AGkijqFUQL/7
after i = 03 x = ]eudWlouHFGNt2.z
after i = 04 x = Rvtu+Q`\W:BRA4IL
after i = 05 x = SQRY.=94hp/obwz/
after i = 06 x = M]L?TW]0./6\kgbE
after i = 07 x = *:zm14:^\]d9HD?s
after i = 08 x = vrmPXhWJ_bh;9:Ag
after i = 09 x = J-5E4x<?EighoDSO
after i = 10 x = msFDELr0,x[csbUj
after i = 11 x = rszO^ZU8@P?2GJPt
after i = 12 x = fn-m`ux-QOPW,;72
after i = 13 x = 4Zie`CK[J=RU[.,-
after i = 14 x = 8\Z[b7FB=qy8xk/2
after i = 15 x = 78?etpkNVfUH]`f9
 before loop x = GO_NAVY_2018^mid
after i = 00 x = @dbcj?NJEy0@/s7:
after i = 01 x = Kq/+wZbraTilrECD
after i = 02 x = v,Ra]X;CSB5JMSwu
after i = 03 x = ^3B>9mu4tg+.4XVW
after i = 04 x = H]`f978?etpkNVfU
after i = 05 x = qFUQL/7G6z>AGkij
after i = 06 x = yh[psyLJKRx62-ai
after i = 07 x = Yhd_BJZI<QTZ-+,3
after i = 08 x = _]^e:IE@t+;*n25;
after i = 09 x = \Odgm@>?Fl*wrU]m
after i = 10 x = \XS6>N=0EHNrpqxM
after i = 11 x = 4hp/obwz/SQRY.=9
after i = 12 x = 423:`okfIQaPCX[a
after i = 13 x = *2B1u9<BfdelAPLG
after i = 14 x = s1-y\dtcVkntGEFM
after i = 15 x = wx.Tc_Z=EUD7LOUy


hash algorithm: shift+clear
message/password: hotcakes
hash algorithm: shift+clear
message/password: hotcekes
 before loop x = GO_NAVY_2018^mid
after i = 00 x = _2018^midGO_NAVY
after i = 01 x = 018^midGO_NAVY_2
after i = 02 x = O_NAVY_2018^midG
after i = 03 x = _NAVY_2018^midGO
after i = 04 x = 8^midGO_NAVY_201
after i = 05 x = _NAVY_2018^midGO
after i = 06 x = AVY_2018^midGO_N
after i = 07 x = ^midGO_NAVY_2018
after i = 08 x = midGO_NAVY_2018^
after i = 09 x = Y_2018^midGO_NAV
after i = 10 x = midGO_NAVY_2018^
after i = 11 x = dGO_NAVY_2018^mi
after i = 12 x = _2018^midGO_NAVY
after i = 13 x = 2018^midGO_NAVY_
after i = 14 x = O_NAVY_2018^midG
after i = 15 x = 2018^midGO_NAVY_
 before loop x = GO_NAVY_2018^mid
after i = 00 x = _2018^midGO_NAVY
after i = 01 x = 018^midGO_NAVY_2
after i = 02 x = O_NAVY_2018^midG
after i = 03 x = _NAVY_2018^midGO
after i = 04 x = 8^midGO_NAVY_201
after i = 05 x = _NAVY_2018^midGO
after i = 06 x = AVY_2018^midGO_N
after i = 07 x = ^midGO_NAVY_2018
after i = 08 x = midGO_NAVY_2018^
after i = 09 x = Y_2018^midGO_NAV
after i = 10 x = midGO_NAVY_2018^
after i = 11 x = dGO_NAVY_2018^mi
after i = 12 x = _2018^midGO_NAVY
after i = 13 x = 2018^midGO_NAVY_
after i = 14 x = O_NAVY_2018^midG
after i = 15 x = 2018^midGO_NAVY_