From 19985dbb8c0aa66dc4bf7905abc1148de909097d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Tue, 11 Jan 2022 12:35:47 +0100 Subject: prvi-commit --- .../sodium_compat/src/Core32/HSalsa20.php | 141 +++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 vendor/paragonie/sodium_compat/src/Core32/HSalsa20.php (limited to 'vendor/paragonie/sodium_compat/src/Core32/HSalsa20.php') diff --git a/vendor/paragonie/sodium_compat/src/Core32/HSalsa20.php b/vendor/paragonie/sodium_compat/src/Core32/HSalsa20.php new file mode 100644 index 0000000..39287f2 --- /dev/null +++ b/vendor/paragonie/sodium_compat/src/Core32/HSalsa20.php @@ -0,0 +1,141 @@ + 0; $i -= 2) { + $x4 = $x4->xorInt32($x0->addInt32($x12)->rotateLeft(7)); + $x8 = $x8->xorInt32($x4->addInt32($x0)->rotateLeft(9)); + $x12 = $x12->xorInt32($x8->addInt32($x4)->rotateLeft(13)); + $x0 = $x0->xorInt32($x12->addInt32($x8)->rotateLeft(18)); + + $x9 = $x9->xorInt32($x5->addInt32($x1)->rotateLeft(7)); + $x13 = $x13->xorInt32($x9->addInt32($x5)->rotateLeft(9)); + $x1 = $x1->xorInt32($x13->addInt32($x9)->rotateLeft(13)); + $x5 = $x5->xorInt32($x1->addInt32($x13)->rotateLeft(18)); + + $x14 = $x14->xorInt32($x10->addInt32($x6)->rotateLeft(7)); + $x2 = $x2->xorInt32($x14->addInt32($x10)->rotateLeft(9)); + $x6 = $x6->xorInt32($x2->addInt32($x14)->rotateLeft(13)); + $x10 = $x10->xorInt32($x6->addInt32($x2)->rotateLeft(18)); + + $x3 = $x3->xorInt32($x15->addInt32($x11)->rotateLeft(7)); + $x7 = $x7->xorInt32($x3->addInt32($x15)->rotateLeft(9)); + $x11 = $x11->xorInt32($x7->addInt32($x3)->rotateLeft(13)); + $x15 = $x15->xorInt32($x11->addInt32($x7)->rotateLeft(18)); + + $x1 = $x1->xorInt32($x0->addInt32($x3)->rotateLeft(7)); + $x2 = $x2->xorInt32($x1->addInt32($x0)->rotateLeft(9)); + $x3 = $x3->xorInt32($x2->addInt32($x1)->rotateLeft(13)); + $x0 = $x0->xorInt32($x3->addInt32($x2)->rotateLeft(18)); + + $x6 = $x6->xorInt32($x5->addInt32($x4)->rotateLeft(7)); + $x7 = $x7->xorInt32($x6->addInt32($x5)->rotateLeft(9)); + $x4 = $x4->xorInt32($x7->addInt32($x6)->rotateLeft(13)); + $x5 = $x5->xorInt32($x4->addInt32($x7)->rotateLeft(18)); + + $x11 = $x11->xorInt32($x10->addInt32($x9)->rotateLeft(7)); + $x8 = $x8->xorInt32($x11->addInt32($x10)->rotateLeft(9)); + $x9 = $x9->xorInt32($x8->addInt32($x11)->rotateLeft(13)); + $x10 = $x10->xorInt32($x9->addInt32($x8)->rotateLeft(18)); + + $x12 = $x12->xorInt32($x15->addInt32($x14)->rotateLeft(7)); + $x13 = $x13->xorInt32($x12->addInt32($x15)->rotateLeft(9)); + $x14 = $x14->xorInt32($x13->addInt32($x12)->rotateLeft(13)); + $x15 = $x15->xorInt32($x14->addInt32($x13)->rotateLeft(18)); + } + + return $x0->toReverseString() . + $x5->toReverseString() . + $x10->toReverseString() . + $x15->toReverseString() . + $x6->toReverseString() . + $x7->toReverseString() . + $x8->toReverseString() . + $x9->toReverseString(); + } +} -- cgit v1.2.3