Commit Graph

237 Commits

Author SHA1 Message Date
Yawning Angel
44758f2a60 core/crypto: Stop using context.temp_allocator
The max digest size for the foreseeable future will be 512 bits, and the
max block size is currently 1152 bits (SHA3-224).  If people add more
exotic hash algorithms without bumping the constants when required,
tests will fail.

The stream buffer will currently be 576 bytes, which is "fine" to just
stick on the stack, and is a sensible multiple of the more common block
size of 64 bytes.
2024-02-07 02:33:53 +09:00
Yawning Angel
1cc639bc93 core/crypto/hmac: Initial import 2024-02-07 00:42:01 +09:00
Yawning Angel
2357293e05 core/crypto/hash: Make the low level interface allocator-less
Just (ab)using reflect to victory is probably fine.
2024-02-07 00:37:18 +09:00
Yawning Angel
bc160d2eb7 tests/core/crypto: Reorganize
All of our crypto is modern now unless exiled to the legacy sub-package,
so move the test cases for the currently un-unified algorithms into the
main test driver file, and rename the benchmark driver to reflect
reality.
2024-02-07 00:37:18 +09:00
Yawning Angel
b02b85d242 core/crypto/shake: SHAKE is an XOF, not a hash 2024-02-07 00:37:18 +09:00
Yawning Angel
1d151c4c92 tests/core/crypto: Cleanup/modernize a bit 2024-02-07 00:37:18 +09:00
Yawning Angel
00ab3beed9 core:crypto/hash: Add a generic higher level hash interface
There is a lot of code duplicated in convenience methods in each hash
implementation, and having a generic hash type makes implementing
higher-level constructs such as HMAC significantly easier down the road.
2024-02-07 00:37:18 +09:00
Laytan Laats
606f11ebe8 fix hxa test use after free, skip weird pow test failure 2024-02-02 21:10:11 +01:00
gingerBill
3e7e779abf Replace core:* to base:* where appropriate 2024-01-28 22:18:51 +00:00
Jeroen van Rijn
7d3dfb1046 Merge pull request #3006 from hwchen/hwchen/last_index_any
fix strings.last_index_any for single char
2024-01-08 15:57:36 +01:00
Jeroen van Rijn
4efef08c94 Update core:encoding to Unicode 15.1 table. 2024-01-02 18:03:32 +01:00
Walther Chen
031b0cc534 fix strings.last_index_any for single char 2023-12-18 11:55:45 -05:00
Laytan Laats
4ae021cd4c add other failing test and fix them 2023-12-18 15:17:27 +01:00
Laytan Laats
af962526df switch tests around 2023-12-18 14:46:37 +01:00
Laytan Laats
6024af172c add failing test for runtime arena edge case 2023-12-18 14:40:49 +01:00
Hector
82088e4a75 Used strings.builder_reset instead of clear for the string builder 2023-11-25 16:26:29 +00:00
Hector
b12bfe407d Updated to tabs and used provided test methods. 2023-11-25 16:21:48 +00:00
Hector
1db5e1250f Binary search improvements
Modified the algorithm so that the index is either the location of the
element if found or the index at which to insert the element to maintain
sorted order.

Also added some tests to verify the above claim.
2023-11-25 13:48:48 +00:00
Jeroen van Rijn
4d89249caf Merge pull request #2939 from laytan/allow-larger-thread-poly-data
Allow larger thread poly data
2023-11-24 14:06:24 +01:00
laytan
2e64866838 fix self_cleanup causing join to fail 2023-11-20 21:23:12 +01:00
Yawning Angel
59950bcad6 core/crypto: Exile keccak, md5 and sha1 to legacy
In an perfect world these would just be removed, but the world is
imperfect, and people are forced to interact/interface with things
that are broken.
2023-11-17 19:32:11 +09:00
Yawning Angel
8af6da5de1 core/crypto/whirlpool: Remove, historical/exotic 2023-11-17 19:31:51 +09:00
Yawning Angel
0b86038482 core/crypto/tiger: Remove, historical/exotic 2023-11-17 19:31:51 +09:00
Yawning Angel
8d943f5902 core/crypto/streebog: Remove, exotic 2023-11-17 19:31:51 +09:00
Yawning Angel
32b27c690d vendor/botan/skein512: Remove, use SHA-3 2023-11-17 19:31:51 +09:00
Yawning Angel
3494a6dcd8 core/crypto/ripemd: Remove, historical/exotic 2023-11-17 19:31:51 +09:00
Yawning Angel
235fec23af core/crypto/md4: Remove, badly broken 2023-11-17 19:31:51 +09:00
Yawning Angel
97b066f112 core/crypto/md2: Remove, badly broken 2023-11-17 19:31:51 +09:00
Yawning Angel
a99c0b3e4a core/crypto/jh: Remove, use SHA-3 2023-11-17 19:31:51 +09:00
Yawning Angel
2a6fb3a387 core/crypto/haval: Remove, badly broken 2023-11-17 19:31:51 +09:00
Yawning Angel
65204f13a8 core/crypto/groestl: Remove, use SHA-3 2023-11-17 19:31:51 +09:00
Yawning Angel
8438d66e6b core/crypto/gost: Remove, exotic 2023-11-17 19:31:51 +09:00
Yawning Angel
44c8da7bf2 core/crypto/blake: Remove, use BLAKE2b/BLAKE2s 2023-11-17 19:31:51 +09:00
Yawning Angel
41fdcfeecf core/crypto/sha2: Add SHA-512/256 2023-11-17 19:31:51 +09:00
Laytan Laats
50f86dc14f Fix shadowing 2023-11-15 19:08:05 +01:00
Laytan Laats
9078ddaf5a Allow larger thread poly data
The poly data currently has the restriction of being less than a
pointer's size, but there is much more space in the `Thread.user_args`
array which can be utilized, this commit allows you to pass types that are
larger than pointer length as long as the total size of the poly data is
less than that of the `Thread.user_args`.
2023-11-15 19:08:03 +01:00
Jeroen van Rijn
761a079789 Fix net.split_url
Resolves issue #2924
2023-11-09 16:56:54 +01:00
Jeroen van Rijn
744eb7c6d8 Delete test artifact. 2023-11-04 22:47:59 +01:00
Jeroen van Rijn
4cb0edc90b Work around LLVM idiocy. 2023-11-04 22:42:32 +01:00
Jeroen van Rijn
6201280468 Add math.pow2_f{16,32,64}, fast floating point 2^x where x is an integer. 2023-11-04 22:14:44 +01:00
Jeroen van Rijn
f5febb633c Temporarily disable RTTI test on Windows. 2023-10-31 13:12:17 +01:00
Jeroen van Rijn
82cd30a145 Add test for RTTI 2023-10-30 13:06:45 +01:00
Rickard Andersson
2e3224a138 testing: add test for Out_Of_Memory return 2023-10-02 15:17:06 +03:00
Jeroen van Rijn
81fe93127d Make core:net test os.exit(1) on failure. 2023-09-30 22:47:49 +02:00
Jeroen van Rijn
aa5716d3f9 Allow any order of query strings in net.join_url tests. 2023-09-30 22:36:50 +02:00
Jeroen van Rijn
07cd6cd670 Change large math/big test literals to hex.
In September 2022, the Python team addressed a possible DoS issue converting big integers to and from base 10 strings: https://github.com/python/cpython/issues/95778

Converting to/from base 10 is a quadratic operation, so they limited it to 4300 digits: https://discuss.python.org/t/int-str-conversions-broken-in-latest-python-bugfix-releases/18889/83

Github CI still uses an old Python version which parsed our test suite just fine. This patch converts them to hex literals to ensure our test doesn't break when Github does update to a non-vulnerable Python version released after September 2022.
2023-09-30 11:16:36 +02:00
Abdelrahman Farid
9ed36445b9 Add test for utf8 multibyte strings 2023-09-19 22:18:23 +03:00
Laytan Laats
287beaff35 use KiB etc. instead of KB 2023-09-12 16:49:42 +02:00
Laytan Laats
aab2fa1af9 fix test case 2023-09-01 19:53:24 +02:00
Laytan Laats
4cf176de0b actually run the test 2023-09-01 19:51:53 +02:00