From 5fd02d3919a059868780375c4a247b16b9519648 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Tue, 7 Jul 2020 20:30:22 +0300 Subject: [PATCH] Fix gost28147.addmod with bigger than modulo values --- VERSION | 2 +- install.texi | 2 +- news.texi | 7 +++++++ pygost/__init__.py | 2 +- pygost/gost28147.py | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 4caecc7..b3d791d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.5 +4.6 diff --git a/install.texi b/install.texi index a494da6..dcbaebd 100644 --- a/install.texi +++ b/install.texi @@ -1,7 +1,7 @@ @node Download @unnumbered Download -@set VERSION 4.5 +@set VERSION 4.6 No additional dependencies except Python 2.7/3.x interpreter are required. diff --git a/news.texi b/news.texi index e8c8c58..8bcd2c3 100644 --- a/news.texi +++ b/news.texi @@ -3,6 +3,13 @@ @table @strong +@anchor{Release 4.6} +@item 4.6 + @itemize + @item Fix invalid @code{gost28147.addmod}'s behaviour with much + bigger values than the modulo + @end itemize + @anchor{Release 4.5} @item 4.5 @itemize diff --git a/pygost/__init__.py b/pygost/__init__.py index 8c64e1e..2a80079 100644 --- a/pygost/__init__.py +++ b/pygost/__init__.py @@ -3,4 +3,4 @@ PyGOST is free software: see the file COPYING for copying conditions. """ -__version__ = "4.5" +__version__ = "4.6" diff --git a/pygost/gost28147.py b/pygost/gost28147.py index 01368f8..3d6705d 100644 --- a/pygost/gost28147.py +++ b/pygost/gost28147.py @@ -190,7 +190,7 @@ def addmod(x, y, mod=2 ** 32): """ Modulo adding of two integers """ r = x + y - return r if r < mod else r - mod + return r if r < mod else r % mod def _shift11(x): -- 2.44.0