From 0545eb1c4581c0daa1e0b839b865d6540f8ebba9 Mon Sep 17 00:00:00 2001 From: tg Date: Thu, 2 Jan 2014 22:51:01 +0000 Subject: [PATCH] =?UTF-8?q?=E2=80=A2=20use=20R=C4=B3nd=C3=A6l=20MixColumn?= =?UTF-8?q?=20for=20arc4random=5Froundhash=20avalanching;=20=20=20suggeste?= =?UTF-8?q?d=20in=20http://crypto.stackexchange.com/questions/12145=20?= =?UTF-8?q?=E2=80=A2=20add=20pure=20mksh=E2=84=A2=20implementation,=20too,?= =?UTF-8?q?=20while=20here=20(since=20it=20can=20=20=20replace=20NZAATFini?= =?UTF-8?q?sh=20even=20though=20NZATMix=20is=20slower,=20both=20are=20=20?= =?UTF-8?q?=20bijective)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dot.mkshrc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dot.mkshrc b/dot.mkshrc index 0bf8d34..9bd3437 100644 --- a/dot.mkshrc +++ b/dot.mkshrc @@ -1,8 +1,8 @@ # $Id$ -# $MirOS: src/bin/mksh/dot.mkshrc,v 1.85 2013/08/22 13:46:46 tg Exp $ +# $MirOS: src/bin/mksh/dot.mkshrc,v 1.86 2014/01/02 22:51:01 tg Exp $ #- # Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012, 2013 +# 2011, 2012, 2013, 2014 # Thorsten Glaser # # Provided that these terms and disclaimer and all copyright notices @@ -380,6 +380,14 @@ function Lnzathash_end { print ${Lnzathash_v#16#} fi } +function Lnzathash_mix { + local -Uui16 t + + ((# t = ((Lnzathash_v >> 7) & 0x01010101) * 0x1B )) + ((# t ^= (Lnzathash_v << 1) & 0xFEFEFEFE )) + ((# Lnzathash_v = t ^ (t <<< 24) ^ (Lnzathash_v <<< 8) ^ \ + (Lnzathash_v <<< 16) ^ (Lnzathash_v <<< 24) )) +} # strip comments (and leading/trailing whitespace if IFS is set) from # any file(s) given as argument, or stdin if none, and spew to stdout