From 4690fe53da4e8b2b43e0cb1d500e12429893a643 Mon Sep 17 00:00:00 2001 From: PlexSheep Date: Tue, 25 Apr 2023 12:04:16 +0200 Subject: [PATCH] shifts are still garbage --- src/authur1.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/authur1.py b/src/authur1.py index b17c91b..85592eb 100755 --- a/src/authur1.py +++ b/src/authur1.py @@ -23,16 +23,16 @@ CHAR_BIT = 8 VALUE_SIZE = 4 """ -The rotations are tested agains a c implementation and seem to work fine. +The rotations are tested agains a c implementation and are still garbage. FIXME """ def rotl(value: int, count: int) -> int: mask: int = CHAR_BIT * VALUE_SIZE - 1; - count &= mask; + count = count & mask return (value << count) | (value >> (-count & mask)); def rotr(value: int, count: int) -> int: mask: int = CHAR_BIT * VALUE_SIZE - 1; - count &= mask; + count = count & mask return (value >> count) | (value << (-count & mask)); """