Пример #1
0
        /// <summary>
        /// Encrypts specified computed information.
        /// </summary>
        /// <returns>Encrypted serial number using SKA-2 and formatted using ISF-2.</returns>
        public override string Store(decimal data)
        {
            // This part of the function uses Artem's SKA-2
            var resultString = data.ToString(CultureInfo.InvariantCulture);

            return(ArtemHasher.Base10ToBase26(ArtemHasher.Hash8Byte(resultString) + Encrypt(resultString)));
        }
Пример #2
0
 /// <summary>
 /// Calculate hash from decoded key.
 /// </summary>
 /// <param name="decoded">Decoded key.</param>
 /// <returns>Calculated hash value from decoded key.</returns>
 /// <remarks>
 /// Don't be confused with <see cref="GetStoredHashFromKey"/>. This method
 /// calculate hash value based on encrypted information on serial key, not
 /// by decoding stored hash.</remarks>
 public override string CalculateHashFromKey(string decoded)
 {
     return(ArtemHasher.Hash8Byte(decoded.Substring(9, 19)).ToString().Substring(0, 9));
 }
Пример #3
0
        /// <summary>
        /// Decrypts specified information using SKA-2 algorithm.
        /// </summary>
        /// <param name="serial">Formatted serial key using ISF-2.</param>
        /// <returns>Decoded SKA-2 message.</returns>
        public override string Retrieve(string serial)
        {
            var usefulInformation = ArtemHasher.Base26ToBase10(serial);

            return(usefulInformation.Substring(0, 9) + Decrypt(usefulInformation.Substring(9)));
        }