add Loaathash1 (iv=0x100 ipv 0)

This commit is contained in:
tg 2010-01-25 14:29:34 +00:00
parent 2e9654ffa4
commit bbb4a1a70f
1 changed files with 11 additions and 4 deletions

View File

@ -1,7 +1,7 @@
# $Id$
# $MirOS: src/bin/mksh/dot.mkshrc,v 1.52 2009/12/12 22:27:14 tg Exp $
# $MirOS: src/bin/mksh/dot.mkshrc,v 1.53 2010/01/25 14:29:34 tg Exp $
#-
# Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009
# Copyright (c) 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010
# Thorsten Glaser <tg@mirbsd.org>
#
# Provided that these terms and disclaimer and all copyright notices
@ -310,14 +310,21 @@ function Loaathash_add {
(( u )) || set -U
}
function Loaathash {
Loaathash_result=0 # hmm...
function Loaathash_do {
Loaathash_add "$@"
((# Loaathash_result += Loaathash_result << 3 ))
((# Loaathash_result = (Loaathash_result ^
(Loaathash_result >> 11)) * 32769 ))
print ${Loaathash_result#16#}
}
function Loaathash {
Loaathash_result=0
Loaathash_do "$@"
}
function Loaathash1 {
Loaathash_result=0x100
Loaathash_do "$@"
}
# 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