TCOI: THE CODE OF ISHAQ

ABSTRACT: In this Document, we will go through the structure of a variant of hashing that will introduce Hashfiles, Hashservers and Ishaq Codes, which revolves around generating random codes stored in a key-value pairs file called a Hashfile linked to their original value, such will be an HTTP web service called a Hashserver that will host this program, which is called a Hasher, and users will be able to request Ishaq Codes from the Hashserver, and so will the Hashserver retrieve those codes from the Hashfile and respond with them back to the user.

1. HASHERS

The Hasher is the main program that receives a string value, called a text, and then validate if the text is already coded in the Hashfile or not. If it was, then the Hasher will return the code (i.e. the Ishaq Code) back to the user.

If the text wasn’t found in the Hashfile then the Hasher will generate a random 28-letter sequence of characters and insert Q- in the beginning. Such will be the new Ishaq Code for that value, which will be returned to the user and appended to the Hashfile.

Such means that the User will always receive the same Ishaq Code if he has given the same text value.

2. HASHFILES

Hashfiles are files named .hashfile which will contain the hashes generated by the Hasher. An Example of the content of a Hashfile is the following:

ishaq: Q-vN8HH8ZBnjJZaemFGr.B5Z8qlKBI random text: Q-MsG4Lf0O9zCZgTqmy21UvtAVKUai hello: Q-2I6FNiwHvIWuEl2tnW3229N5ZAaY

3. HASHSERVERS

A Hashserver is an HTTP web service that hosts a Hasher which performs the functionality explained above, which is an implementation of decentralised Ishaq Codes, as the use of a Hasher alone isn’t practical.

Users may send POST requests to the Hashserver’s home / route and the Response will be a JSON-formatted response that consists of an object containing two values, that are text which is the original value requested, and tcoi which is the Ishaq Code.
If the / Route gets a DELETE Request, which clears the Hashfile and deletes all codes, the HTTP Request would need an Authorization Header which contains a Secret Passphrase that permits him to perform that operation.
If the / Route gets an authorised GET request, it will return a list of all the currently generated codes.
If the / Route gets a usual GET request, it'll respond with text saying: TCOI Hashserver @ [Hashserver's IP Address or full Domain]

Hashservers are conventionally hosted on the subdomain hs, as an example: http://hs.example.com

USAGE

IN PYTHON

In order to use TCOI, you need to download it. You can either fork the Repository or run:

pip install tcoi

Now you can import the tcoi module in your application and make a Hasher Instance, then use it to get TCOI codes, clear your hashfile, and more. An Example of a simple TCOI-powered program would be:

```python from tcoi import Hasher

text = input("Q>>> ").strip()

hasher = Hasher()

result = hasher.get_tcoi(text)

print(f"{result['text']}: {result['tcoi']}") ```

IN RUST

You can also fork the Repository or add tcoi to your dependencies:

cargo add tcoi

Then make an Instance of the Hasher Struct and use the get_tcoi method to retrieve TCOI codes.

See rust/examples/main.rs: ```rust use std::io::{self, Write};

use tcoi::Hasher;

fn main() { let mut input_text = String::new();

print!("Q>>> ");
io::stdout().flush().unwrap();

io::stdin()
    .read_line(&mut input_text)
    .expect("UNEXPECTED INPUT!");

let text = input_text.trim().to_string();

let hasher = Hasher {};

match hasher.get_tcoi(text.clone()) {
    Ok(hashmap) => println!("{}: {}", text, hashmap[&text]),
    Err(_) => println!("ERROR: EMPTY TEXT!"),
}

} ```

CONCLUSION

The Code of Ishaq is an alternative form of hashing that aims to implement decentralised hashservers that accomplish the goal needed to validate information.