Code used for my Bachelor's Thesis
Go to file
Knyffen b9645f15ff Better string handling
The text and pattern are now streamed directly (skipping saving them to
strings).
Knowing exactly what string was matched has now been delegated to
the Rabin_fingerprint_process.
2021-11-14 18:13:51 +01:00
books Better string handling 2021-11-14 18:13:51 +01:00
helper_code A bit of cleanup 2021-11-14 14:48:58 +01:00
to_be_rewritten_bin A bit of cleanup 2021-11-14 14:48:58 +01:00
V1 Better string handling 2021-11-14 18:13:51 +01:00
.gitignore Initial commit 2021-11-14 12:58:08 +00:00
compare_fingerprint_false_positive_probabilities.sage Init (add codebase) 2021-11-14 14:35:05 +01:00
general_library.cpp Init (add codebase) 2021-11-14 14:35:05 +01:00
general_library.hpp Init (add codebase) 2021-11-14 14:35:05 +01:00
Makefile Abstrack simple string matching to a process 2021-11-14 16:19:11 +01:00
processes.cpp Better string handling 2021-11-14 18:13:51 +01:00
processes.hpp Better string handling 2021-11-14 18:13:51 +01:00
Rabin_fingerprint.cpp Init (add codebase) 2021-11-14 14:35:05 +01:00
Rabin_fingerprint.hpp Abstrack simple string matching to a process 2021-11-14 16:19:11 +01:00
README.md Better string handling 2021-11-14 18:13:51 +01:00
simple_string_matching Better string handling 2021-11-14 18:13:51 +01:00
simple_string_matching.cpp Better string handling 2021-11-14 18:13:51 +01:00
test_rabin_fingerprint.sage Init (add codebase) 2021-11-14 14:35:05 +01:00

Bachelor's_Thesis_Code

Code used for my Bachelor's Thesis

Issues

When reading the pattern from a file, according to UNIX standards (read details here) a "text file" has to end on a newline.
This adds an unintended newline to the end of the pattern, so to avoid adding said newline, write the file using:
echo -n word > pattern.txt
or if you use Vim, remove the newline using

:set binary
:set noeol
:wq

Versions

Current Version

Compared to V1, in this current state generate_initial_irreducible_polynomials.sage, generate_random_irreducible_polynomial.sage, and multiply_polynomials_modulo_polynomial.sage have been removed from the main folder, as they have already been used for implementing their corresponding features in general_library.cpp. They will be preserved in the V1 folder.

This version also contains code relating to Porat-Porat and other random code stumps. This code is going to be completely reimplemented, but is preserved for now to avoid redoing work.

V1

general_library.cpp

  • Exports functions for:
    • Generating a random irreducible polynomial of degree up to 31.
  • Contains code for:
    • Contains code to multiply polynomials modulo another polynomial.
    • Doesn't contain code to initially calculate modulo a polynomial. It requires the initial polynomials to all be at most of the same degree as the polynomial that you use for modulo.
    • A very custom version of calculating Reduced Row Echelon Form assuming all values are in Z2.

generate_initial_irreducible_polynomials.sage

  • Generates a list of irreducible polynomials, one of each degree. The polynomials are printed in a format that can be copy-pasted directly into general_library.cpp.

generate_random_irreducible_polynomial.sage

  • Contains an general template of how general_library.cpp should implement generating a random irreducible polynomial. The output of this program can also be used for debugging, since it uses many (correctly implemented) built-in sagemath functions that have to manually implemented in general_library.cpp.

multiply_polynomials_modulo_polynomial.sage

  • Contains a general template of how general_library.cpp should implement multiplying polynomials modulo a polynomial in Z2.

compare_fingerprint_false_positive_probabilities.sage

  • Contains initial (i.e. very rouch) code, which compares the upper bounds of a false match occuring of the Rabin fingerprint and the fingerprint used in Karp-Rabin.

test_rabin_fingerprint.sage

  • Contains initial (i.e. very rough) code which debunks my theory that modulo a prime is somewhat equivalent to modulo an irreducible polynomial.