tughra

1.0.1 • Public • Published

Tughra Library Guide

The Tughra Library offers robust End-to-End Encryption (E2EE), ensuring that data remains private and secure from the point it leaves the sender to the moment it reaches the intended recipient. With E2EE, data is encrypted on the sender's device, transmitted as unreadable ciphertext, and decrypted only by the authorized recipient, meaning no intermediaries (such as service providers or unauthorized third parties) can access the plaintext data during transit. This design is crucial for safeguarding sensitive information, as it prevents unauthorized access at any stage of data transmission. Tughra’s implementation of E2EE leverages advanced algorithms and customizable encryption cycles, allowing developers to configure secure, high-performance encryption processes directly into their applications.

1. Overview

The Tughra Library offers encryption methods such as Turgha, Caesar, Vigenere, XOR, and custom options. With features like configurable encryption modes, base character sets, and custom keys, it provides a flexible solution for encryption and decryption.

Demo

Here’s a simple demo of how to use the Tughra Library to encrypt and decrypt a message, filesm images, audios, videos, and more.

Demo

2. Getting Started

Initialize the Tughra library by creating an instance of the Tughra class.

Ensure you have the Tughra Library available in your project. You can either include it as a script or import it as a module in your JavaScript file.

Adding the Tughra Library Script

Installing via npm

You can also install the Tughra Library via npm. Run the following command in your terminal:

 npm install tughra

If you have the tughra.js file locally, place it in the same directory as your HTML file or in a designated js folder. You can also include it from a CDN or UNPKG. Add the following <script> tags in the <head> section of your HTML file:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Tughra Library Guide</title>

<!-- Link to Tughra Library (local file) --> <script src="tughra.js"></script>

<!-- Link to Tughra Library (CDN) --> <script src="https://cdn.jsdelivr.net/npm/tughra@1.0.0/tughra.min.js"> </script> <!-- Link to Tughra Library (UNPKG) --> <script src="https://unpkg.com/tughra@1.0.0/tughra.min.js"> </script>

<style> /* Your CSS styling here */ </style> </head> <body> <!-- HTML content here --> </body> </html>

Initialize the Tughra object

const tughra = new Tughra(mode, baseCharset, algorithm, encryptionKey, useBaseEncoding);

Example 1:

const tughra = new Tughra('encrypt', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'caesar', 'myKey', false);

Example 2:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Tughra Library Guide</title>

<!-- Link to Tughra Library --> <script src="tughra.js"></script>

<!-- Link to Tughra Library (CDN) --> <script src="https://cdn.jsdelivr.net/npm/tughra@1.0.0/tughra.min.js"> </script> <!-- Link to Tughra Library (UNPKG) --> <script src="https://unpkg.com/tughra@1.0.0/tughra.min.js"> </script>

<style> /* Your CSS styling here */ </style> </head> <body> <!-- HTML content here --> <div class="container"> <h1>Tughra Encryption Demo</h1>
<label for="inputText">Enter Text to Encrypt:</label> <input type="text" id="inputText" placeholder="Type something..."> <button onclick="encryptText()">Encrypt Text</button> <h2>Encrypted Result:</h2> <p id="encryptedOutput">Your encrypted text will appear here.</p> </div> <!-- JavaScript for Tughra library --> <script> // Initialize the Tughra library and add encryption function document.addEventListener('DOMContentLoaded', function () { const tughra = new Tughra('encrypt', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'caesar', 'myKey'); window.encryptText = function () { const inputText = document.getElementById('inputText').value; if (inputText) { const encryptedText = tughra.process(inputText, 3); // Adjust cycles as needed document.getElementById('encryptedOutput').innerText = encryptedText; } else { document.getElementById('encryptedOutput').innerText = 'Please enter text to encrypt.'; } }; }); </script> </body> </html>

3. Configuring the Library

3.1 Mode

Set the mode to either encrypt or decrypt. The default mode is encrypt.

3.2 Base Charset

The baseCharset parameter defines the set of characters for encoding, e.g., Base64 or a custom set.

3.3 Algorithm

Choose an encryption algorithm like Tughra, caesar, vigenere, XOR, ROT47, Substitution, Base64, ASCII Shift, Unicode Shift, Numeric, Reversed Caesar, ROT13, ROT18, ROT25, XOR Pro, Affine Pro, Substitution Pro, ROT30, Affine, or Atbash.

Note: some algorithm support only latin 1 group, but Tughra algorithm support all groups around the world.

4. Processing Text

Use the process method to encrypt or decrypt text, specifying the number of cycles and the input text.

Example:

const encryptedText = tughra.process("Hello, World!", 3);

5. Error Handling

If the encryption key doesn't meet the required strength, an error will be thrown. Ensure keys meet the minimum length requirement.

6. Advanced Features

6.1 Custom Algorithms

Tughra supports advanced algorithms like Affine Pro and Substitution Pro for enhanced encryption.

7. Additional Functions

Auto-Generate Key Offsets

Use the generateKey function to create key offsets:

const tughra = new TughraLibrary(); // Adjust to your class instance
const keyOffsets = tughra.generateKey(5, 'Basic Latin');

Cycle Adjustment

Cycles can be adjusted dynamically using buttons in the interface or by specifying them directly in the method call.

Character-Type Preservation

Tughra maintains the character type of input text, preserving the format across languages:

const encryptedText = tughra.process("Hello", cycles);

Base64 Encoding/Decoding for Files

For applications needing Base64 handling set useBaseEncoding to true:

const tughra = new Tughra('encrypt', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'caesar', 'myKey', true);
const encryptedText = tughra.process("Hello, World!", 3);
const decryptedText = tughra.process(encryptedText, 3);

Usage Cases

  • Secure Data Transmission: Encrypt messages and files before sending them over insecure channels to protect sensitive information from eavesdroppers.
  • Data Storage Security: Encrypt data stored in databases or file systems to prevent unauthorized access and ensure data privacy.
  • File Encryption: Support for encrypting and decrypting files of all types, ensuring that sensitive documents are protected from unauthorized access.
  • Educational Tool: Demonstrate and explore cryptographic techniques and algorithms for learning purposes.
  • Password Management: Safely encrypt and store user passwords or sensitive credentials.

Important Note

Note: The Tughra method requires the correct keyOffsets and cycles for decryption. Retain these values to prevent data loss.

The Tughra Encryption System provides superior protection through the use of encryption techniques based on random keys and multiple rounds of encryption, making it suitable for various fields and uses. Here is a comprehensive list of areas where this system can be beneficial:

Contents

1. Protecting Personal Data
2. Securing Communications
3. Securing Digital Content
4. E-Commerce
5. Securing Applications and Software
6. Identity Verification
7. Securing Systems and Networks
8. Cloud Storage
9. Protecting Software
10. Protecting Data in the Internet of Things (IoT)
11. Protecting Financial Data
12. Digital Forensics
13. Scientific and Academic Research
14. Encryption in Video Games
15. Securing Educational Institutions
16. Legal Transactions and Electronic Contracts
17. E-Government Systems
18. Secure Email Services
19. Protecting Media and Journalistic Content
20. Logistics and Supply Chains
21. Creating Cryptocurrency
22. Secure Electronic Voting System
23. Decentralized Cloud Computing
24. Securing Decentralized Digital Trade Platforms (DeFi)
25. Digital Rights Management (DRM)
26. Securing Financial Systems for Major Corporations
27. Advanced IoT Systems
28. Next-Generation Digital Infrastructure Systems (5G)
29. Managing Sensitive Documents for Multinational Corporations
30. Data Transfer Between Drones
31. Securing Military Communications
32. Protecting Government Networks
33. Weapons Management Systems
34. Protecting Data in Travel



<

1. Protecting Personal Data

• Encrypting medical records and sensitive health data.
• Protecting banking information such as account numbers and passwords.
• Encrypting personal identification information (such as electronic passports).

2. Securing Communications

• Encrypting text messages and emails.
• Securing voice and video calls over the internet.
• Protecting conversations in messaging apps like WhatsApp or Telegram.

3. Securing Digital Content

• Encrypting digital images and videos to prevent piracy.
• Protecting paid digital content such as e-books or movies.
• Securing design files and creative works.

4. E-Commerce

• Encrypting electronic payment data, such as credit card information.
• Protecting customer data and online business transactions.
• Securing purchases through e-commerce stores.

5. Securing Applications and Software

• Encrypting data within banking and business applications.
• Protecting data exchanged between application servers and users.
• Securing information stored in application databases.

6. Identity Verification

• Encrypting identity data during online authentication processes.
• Protecting fingerprints or other biometric data.
• Securing identity verification processes through electronic payment platforms.

7. Securing Systems and Networks

• Encrypting data exchanged between devices within the network.
• Protecting networks from cyberattacks such as malware.
• Securing communications within major enterprise networks.

8. Cloud Storage

• Encrypting files and information stored on cloud services like Google Drive.
• Protecting data during transfer between devices and the cloud.
• Securing cloud data from breaches or leaks.

9. Protecting Software

• Encrypting software code to prevent tampering or theft.
• Protecting intellectual property rights for computer programs and applications.
• Securing software applications from external attacks.

10. Protecting Data in the Internet of Things (IoT)

• Encrypting data sent and received between IoT devices.
• Securing smart control systems within homes and businesses.
• Protecting communications between sensors and smart vehicles.

11. Protecting Financial Data

• Encrypting financial data exchanged between banks and financial institutions.
• Securing electronic payment transactions and bank transfers.
• Protecting online bank accounts from breaches.

12. Digital Forensics

• Using encryption to secure digital evidence.
• Protecting information gathered during digital forensic investigations.
• Securing storage of sensitive criminal data.

13. Scientific and Academic Research

• Encrypting data and research information to prevent tampering or theft.
• Protecting academic research and scientific papers from breaches.
• Securing communication between researchers while sharing sensitive information.

14. Encryption in Video Games

• Protecting players' personal data within games.
• Encrypting financial transactions within digital games.
• Securing game servers from cyberattacks.

15. Securing Educational Institutions

• Encrypting sensitive information for students such as academic records.
• Securing data exchanged through e-learning platforms.
• Protecting online exams from cheating or tampering.

16. Legal Transactions and Electronic Contracts

• Encrypting electronic contracts to ensure their integrity.
• Protecting sensitive legal data during online transactions.
• Securing electronic signatures and confirmations.

17. E-Government Systems

• Encrypting citizen data within government databases.
• Securing online transactions and e-government services.
• Protecting communications between government agencies.

18. Secure Email Services

• Encrypting emails to ensure privacy and confidentiality.
• Protecting email exchanges from hackers and breaches.
• Securing communications for sensitive topics.

19. Protecting Media and Journalistic Content

• Encrypting journalistic materials and reports.
• Protecting news organizations from cyberattacks.
• Securing communications with sources.

20. Logistics and Supply Chains

• Encrypting data exchanged between suppliers and distributors.
• Securing communications in logistics systems.
• Protecting sensitive information about shipments.

21. Creating Cryptocurrency

• Encrypting wallet keys to protect cryptocurrency.
• Securing transactions within cryptocurrency systems.
• Protecting user identities in cryptocurrency trading.

22. Secure Electronic Voting System

• Encrypting voting data to ensure integrity and security.
• Protecting voter identities and choices.
• Securing communications within electronic voting systems.

23. Decentralized Cloud Computing

• Encrypting data within decentralized cloud systems.
• Protecting user data in decentralized networks.
• Securing transactions and communications in cloud platforms.

24. Securing Decentralized Digital Trade Platforms (DeFi)

• Encrypting transactions within decentralized finance systems.
• Protecting user identities and financial information.
• Securing smart contracts and transactions.

25. Digital Rights Management (DRM)

• Encrypting digital content to protect intellectual property rights.
• Securing licensing and access controls.
• Protecting copyrighted material.

26. Securing Financial Systems for Major Corporations

• Encrypting data within corporate finance systems.
• Protecting sensitive financial information from breaches.
• Securing transactions and communications between financial systems.

27. Advanced IoT Systems

• Encrypting data exchanged between advanced IoT devices.
• Protecting smart city infrastructure.
• Securing communications between smart systems.

28. Next-Generation Digital Infrastructure Systems (5G)

• Encrypting data within 5G networks.
• Protecting communications and transactions in real-time.
• Securing connections between devices and networks.

29. Managing Sensitive Documents for Multinational Corporations

• Encrypting sensitive documents and files.
• Protecting internal communications and transactions.
• Securing collaborations between multinational teams.

30. Data Transfer Between Drones

• Encrypting data exchanged between drones and control systems.
• Protecting data collected during drone flights.
• Securing communications between multiple drones.

31. Securing Military Communications

• Encrypting military data and communications.
• Protecting sensitive military information from breaches.
• Securing connections between military systems.

32. Protecting Government Networks

• Encrypting data within government networks.
• Protecting sensitive information from cyberattacks.
• Securing communications between government agencies.

33. Weapons Management Systems

• Encrypting data exchanged within weapons systems.
• Protecting sensitive military data.
• Securing communications related to military operations.

34. Protecting Data in Travel

• Encrypting travel documents and itineraries.
• Protecting sensitive information shared during travel.
• Securing communications related to travel arrangements.

Tughra is a developing system that relies on multiple factors that make the decryption process extremely difficult if the person does not have the used fields (character and symbol set) and the number of cycles (frequency). Let’s illustrate the complexity of the decryption process:

  1. Fields (Character Set):
    • If you have about 144,300 characters or symbols, and you are using a random set of these characters to encrypt the text, this adds significant complexity. Each character in the original text could be replaced by a variety of substitutes, making it very difficult to reconstruct the original text without knowing the fields exactly.
  2. Number of Cycles (Frequency):
    • Adding a non-fixed number of cycles greatly increases the complexity of the encryption. If the encryption is done for a random number of cycles, hackers will have countless attempts to determine the correct number of cycles.
  3. Brute Force Attack:
    • Theoretically, any encryption system can be subjected to a brute force attack (trying all possible combinations). However, considering the large number of fields and variable cycles, attempting all combinations would take an enormous amount of time. The more fields and cycles increase, the more the difficulty multiplies significantly.
  4. Complexity of Calculations:
    • Assuming you have an unlimited number of fields and an unlimited number of cycles, the number of possible decryption combinations would be so huge that no modern computer system could handle it in a reasonable time frame. Additionally, if these fields are unknown, the hacker won’t be able to make any logical attempts to decrypt, making the process akin to finding a needle in a haystack.

Expected Time for Decryption:

If a hacker programs an automated code to attempt decryption using a brute force attack, the time required depends on several factors, including:

  • The power of the computers used by the hacker.
  • The number of fields used.
  • The number of cycles.
  • The strength of the random algorithm used to determine the alternative fields.

The larger the number of fields and cycles, the exponentially greater the time required. With large numbers of fields and cycles, the decryption process could reach billions or even trillions of attempts, which means it could take thousands of years or more, depending on the available computing power.

Conclusion

The Tughra library provides a robust encryption solution for text and files, ideal for data security and cryptographic exploration. Without knowing the fields exactly and the number of cycles, decryption using an automated attack would be nearly impossible within a reasonable timeframe.

For more information, visit the Tughra GitHub page.

Package Sidebar

Install

npm i tughra

Weekly Downloads

11

Version

1.0.1

License

MIT

Unpacked Size

2.76 MB

Total Files

11

Last publish

Collaborators

  • mohanad.hatip