New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

gitea.devil.moe/Vampire/cryptosimple

Package Overview
Dependencies
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gitea.devil.moe/Vampire/cryptosimple

Go Modules
Version
v1.2.0
Version published
Created
Source

cryptosimple

Simple ChaCha20 / RSA encryption and decryption tool for exchanging secret information in JSON (over HTTP).

The tool also has a built-in key generation method called Vampire. Vampire generates keys based on the current date (year, month, day) and an application-specific salt.

Vampire salt

The salt specifies how to incorporate date information into the key and can also be accompanied by an application specific string.

A valid salt should be like:

Vampire_|BBB|.|CCC|.|AAA|.|DDD|

which would be converted to:

Vampire_Month.Day.Hour.Minute

This salt must be provided to calculate the final key when encrypting and decrypting.

The month, day, hour, minute is calculated in UTC, so it's timezone-unrelated. You don't have to sync timezone.

Note: To avoid string searches in memory, DO NOT use salts that could IDENTIFY your program.

For example, the generated key Vampire_Month.Day.Hour.Minute in memory can be easily searched by finding string Vampire.

To some extent, this prevents attackers from cracking the key, because they do not know how the key was generated. Even they knew, it's hard for them to get your specfic string.

Vampire is very time-dependent. Even if the time is only a few seconds off, as long as the number of minute is different, the decryption fails. So it is important to have the time synchronized when encrypting & decrypting.

Encrypting and decrypting both require you to provide the parameter of time.Time. You should make sure this time is synchronized.

We have provided an util function called ConvertStrTimestamp2Time(timestamp string) (time.Time, error) to help you convert timestamp in string to time.Time instance.

FAQs

Package last updated on 22 May 2025

Related posts