delium

package module
v1.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2025 License: MIT Imports: 6 Imported by: 0

README

Delium

Go Reference Go Report Card License Version

🔑 This method is very simple but provides a high level of security in terms of safety.

This method, inspired by the film Oppenheimer, is derived from the concept of an atomic explosion. It works by visualizing a string, encoded using the SHA-256 or SHA-512 method, as a specific number of atoms placed together. In an atomic explosion, almost all atoms are destroyed, but our goal is to mathematically make the reverse engineering probability almost zero. Therefore, we remove several specific character sequences from the strings and then re-encode the resulting string using the SHA-256 or SHA-512 method.

Full explanation video

Watch the video

Methods

Delium has two method for encryption, 1-Simple delium 2-Complex delium. In simple delium input string will hash with sha-256/sha-512 and in every cycle of hashing will delete specific chars from hashid string. But in complex delium, we have a path for adding and deleting for every cycle.

Functions

Simple delium
D256

Processes a string data by first hashing it with SHA-256, then repeatedly deleting characters from the resulting hash string at specified intervals, and finally hashing the modified string again with SHA-256.

Parameters:

  • strData: A string representing the data to be processed and hashed.
  • deleteStep: An integer specifying the interval at which characters will be deleted from the hash string.
  • repeat: An integer specifying how many times the deletion process should be applied.

Returns:

  • A pointer to a D_hash struct containing:
    • Byte_slice: A byte slice of the final SHA-256 hash after applying the deletion process the specified number of times.
    • String: A hexadecimal string representation of the final SHA-256 hash.
D512

Processes a string data by first hashing it with SHA-512, then repeatedly deleting characters from the resulting hash string at specified intervals, and finally hashing the modified string again with SHA-512.

Parameters:

  • strData: A string representing the data to be processed and hashed.
  • deleteStep: An integer specifying the interval at which characters will be deleted from the hash string.
  • repeat: An integer specifying how many times the deletion process should be applied.

Returns:

  • A pointer to a D_hash struct containing:
    • Byte_slice: A byte slice of the final SHA-256 hash after applying the deletion process the specified number of times.
    • String: A hexadecimal string representation of the final SHA-256 hash.
Complex delium

Processes a string data by first hashing it with SHA-256, then add strings based on path to the end of hashed string and delete chars based on path. Path can has NOT any addon string but must has at least the deleting chars number.

Path example: "2h4usk#5/73uytg#9/#4"

In this path we use delium 3 times. First we use delium with adding 2h4usk to end of hashing and deleting chars based on 5 intervals. Then we add 73uytg to end of new hash and delete every chars based on 9 intervals. At least we DONT add any string but we do simple delium just once with 4 delete step. ⚠️⚠️⚠️ PATH STRING NOT HAS ANY SPACE ⚠️⚠️⚠️

D256C

Parameters:

  • strData: A string representing the data to be processed and hashed.
  • path: A string representing the path of complex delium.

Returns:

  • A pointer to a D_hash struct containing:
    • Byte_slice: A byte slice of the final SHA-256 hash after applying the complex delium.
    • String: A hexadecimal string representation of the final SHA-256 hash.
D512C

Parameters:

  • strData: A string representing the data to be processed and hashed.
  • path: A string representing the path of complex delium.

Returns:

  • A pointer to a D_hash struct containing:
    • Byte_slice: A byte slice of the final SHA-512 hash after applying the complex delium.
    • String: A hexadecimal string representation of the final SHA-512 hash.

Installation

go get github.com/blvchain/delium

Import

import "github.com/blvchain/delium"

Usage example

package main

import (
    "fmt"
    "github.com/blvchain/delium"
)

func main() {

  // Simple delium
  simpleDelium := delium.D256("example mnemonic", 3, 5)

  fmt.Println("Byte Slice:", simpleDelium.Byte_slice)  // prints the byte slice of the simple delium hash
  fmt.Println("Hex String:", simpleDelium.String)      // prints the hexadecimal string of the simple delium hash

  // Complex delium
  path:= "2h4usk#5/73uytg#9/#4"
  complexDelium := delium.D256C("example mnemonic", path)

  fmt.Println("Byte Slice:", complexDelium.Byte_slice)  // prints the byte slice of the complex delium hash
  fmt.Println("Hex String:", complexDelium.String)      // prints the hexadecimal string of the complex delium hash

}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type D_hash

type D_hash struct {
	Byte_slice []byte
	String     string
}

func D256

func D256(strData string, deleteStep int, repeat int) *D_hash

D256 processes a strData string by first hashing it with SHA-256, then repeatedly deleting characters from the resulting hash string at specified intervals, and finally hashing the modified string again with SHA-256.

Parameters:

  • strData: A string representing the strData phrase to be processed and hashed.
  • deleteStep: An integer specifying the interval at which characters will be deleted from the hash string.
  • repeat: An integer specifying how many times the deletion process should be applied.

Returns:

  • A pointer to a D_hash struct containing:
  • Byte_slice: A byte slice of the final SHA-256 hash after applying the deletion process the specified number of times.
  • String: A hexadecimal string representation of the final SHA-256 hash.

The function works as follows:

  1. Computes the SHA-256 hash of the input strData string.
  2. For a specified number of repetitions, deletes every `deleteStep`-th character from the hash string generated in the previous step.
  3. Computes the SHA-256 hash of the modified string after each repetition.
  4. Returns a D_hash struct with the final SHA-256 hash in both byte slice and hexadecimal string formats.

Example:

result := delium.D256("example strData", 3, 5)
fmt.Println(result.Byte_slice)  // prints the byte slice of the final hash
fmt.Println(result.String)      // prints the hexadecimal string of the final hash

func D256C

func D256C(strData string, path string) *D_hash

D256C is complex delium that performs a specific method of D256:

1. Path example: "2h4usk#5/73uytg#9/#4"

  • path := "addonString1 # deleteStep1 / addonString2 # deleteStep2 / # justDeleteStep3"

2. Purpose:

  • The function takes an initial string `strData` and a `path` (which is not used in this function directly) and processes the hash of `strData` through several iterations.
  • Each iteration involves appending additional strings and recalculating the hash.

3. Procedure:

  • Compute the SHA-256 hash of the input string `strData` to generate an initial hash.
  • Convert this hash from a byte slice to a hexadecimal string representation.
  • Split the hexadecimal hash string using "/" as the delimiter to handle different segments.
  • For each segment:
  • Split the segment by "#" to extract an additional string and a delete step value.
  • Convert the delete step value from a string to an integer.
  • Create a new string by appending the additional string to the current hash string.
  • Recompute the hash of this new string and update the current hash string.
  • Return a `D_hash` struct containing the final hash as both a byte slice and a string.

4. Detailed Steps:

  • Compute the SHA-256 hash using `sha256.Sum256([]byte(strData))`, which provides a 64-byte hash.
  • Convert this hash to a hexadecimal string with `hex.EncodeToString(dataHash[:])`.
  • Split the string into parts using `strings.Split(strDataHash, "/")` to separate different segments for further processing.
  • Iterate over these segments. For each segment:
  • Split by "#" using `strings.Split(part, "#")` to get the `addonString` and the `deleteStep`.
  • Convert `deleteStep` from a string to an integer using `strconv.Atoi(d[1])`. If conversion fails, log an error.
  • Create a new string `newString` by appending `addonString` to the current `strDataHash`.
  • Call `D256(newString, deleteStep, 1).String` to recompute the hash and update `strDataHash`.
  • Finally, create and return a `D_hash` struct containing the final `strDataHash` as a byte slice and string.

The `D_hash` struct is used to encapsulate the result, making it easier to manage and use the final hash value.

The `path` parameter is included for potential future use or compatibility with other parts of the codebase but is not utilized in the current implementation of the function.

func D512

func D512(strData string, deleteStep int, repeat int) *D_hash

D512 processes a strData string by first hashing it with SHA-512, then repeatedly deleting characters from the resulting hash string at specified intervals, and finally hashing the modified string again with SHA-512.

Parameters:

  • strData: A string representing the strData phrase to be processed and hashed.
  • deleteStep: An integer specifying the interval at which characters will be deleted from the hash string.
  • repeat: An integer specifying how many times the deletion process should be applied.

Returns:

  • A pointer to a D_hash struct containing:
  • Byte_slice: A byte slice of the final SHA-512 hash after applying the deletion process the specified number of times.
  • String: A hexadecimal string representation of the final SHA-512 hash.

The function works as follows:

  1. Computes the SHA-512 hash of the input strData string.
  2. For a specified number of repetitions, deletes every `deleteStep`-th character from the hash string generated in the previous step.
  3. Computes the SHA-512 hash of the modified string after each repetition.
  4. Returns a D_hash struct with the final SHA-512 hash in both byte slice and hexadecimal string formats.

Example:

result := delium.D512("example strData", 3, 5)
fmt.Println(result.Byte_slice)  // prints the byte slice of the final hash
fmt.Println(result.String)      // prints the hexadecimal string of the final hash

func D512C

func D512C(strData string, path string) *D_hash

D512C is complex delium that performs a specific method of D512:

1. Path example: "2h4usk#5/73uytg#9/#4"

  • path := "addonString1 # deleteStep1 / addonString2 # deleteStep2 / # justDeleteStep3"

2. Purpose:

  • The function takes an initial string `strData` and a `path` (which is not used in this function directly) and processes the hash of `strData` through several iterations.
  • Each iteration involves appending additional strings and recalculating the hash.

3. Procedure:

  • Compute the SHA-512 hash of the input string `strData` to generate an initial hash.
  • Convert this hash from a byte slice to a hexadecimal string representation.
  • Split the hexadecimal hash string using "/" as the delimiter to handle different segments.
  • For each segment:
  • Split the segment by "#" to extract an additional string and a delete step value.
  • Convert the delete step value from a string to an integer.
  • Create a new string by appending the additional string to the current hash string.
  • Recompute the hash of this new string and update the current hash string.
  • Return a `D_hash` struct containing the final hash as both a byte slice and a string.

4. Detailed Steps:

  • Compute the SHA-512 hash using `sha512.Sum512([]byte(strData))`, which provides a 64-byte hash.
  • Convert this hash to a hexadecimal string with `hex.EncodeToString(dataHash[:])`.
  • Split the string into parts using `strings.Split(strDataHash, "/")` to separate different segments for further processing.
  • Iterate over these segments. For each segment:
  • Split by "#" using `strings.Split(part, "#")` to get the `addonString` and the `deleteStep`.
  • Convert `deleteStep` from a string to an integer using `strconv.Atoi(d[1])`. If conversion fails, log an error.
  • Create a new string `newString` by appending `addonString` to the current `strDataHash`.
  • Call `D512(newString, deleteStep, 1).String` to recompute the hash and update `strDataHash`.
  • Finally, create and return a `D_hash` struct containing the final `strDataHash` as a byte slice and string.

The `D_hash` struct is used to encapsulate the result, making it easier to manage and use the final hash value.

The `path` parameter is included for potential future use or compatibility with other parts of the codebase but is not utilized in the current implementation of the function.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL