SHA256 or SHA512 on a UWP 10 Mobile .NET game

Best Online Casinos

 


1. Sol Casino

Sol casino keyword

Free Sign-Up Bonus: 90 Free Spins ( Free Sign-Up Bonus Link )

 

First Deposit Bonus: 200% up to €/$ 200 ( Registration Link )

 

ENTER SOL CASINO

 


 

2. Fresh Casino

fresh casino

Free Sign-Up Bonus: 40 Free Spins ( Free Sign-Up Bonus Link )

 

First Deposit Bonus: 100% up to €/$ 300 ( Registration Link )

 

SIGN-UP FRESH CASINO

 


 

 

3. Jet Casino

jet casino

Free Sign-Up Bonus: 60 Free Spins ( Free Sign-Up Bonus Link )

 

First Deposit Bonus: 200% up to €/$ 200 ( Registration Link )

 

ENTER JET CASINO

 


 

 

 

SHA256 or SHA512 on a UWP 10 Mobile .NET game







  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Search Unity

Unity ID

A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate in the Unity community.

  1. I wanted to add SHA512 to check if my save game has been edited. But i get this error

    1. Assets\scr.cs(29,17): error CS0246: The type or namespace name ‘SHA256’ could not be found (are you missing a using directive or an assembly reference?)

    This works on a IL2CPP scripting backend game.
    But the unity IAP system doesnt work on IL2CPP.

    IAP is the priority so is there anyway that i can use SHA256 or SHA512 on .NET scripting backend with Universal 10 module?

  2. Yes, but crypto API has changed.

    You should use namespaces `Windows.Security.Cryptography` and `Windows.Security.Cryptography.Core` — you can import them entirely; or (to avoid scope pollution) can introduce explicit aliases for just the types you need (if you don’t mind verbosity), for example:

    1. using System.Runtime.InteropServices.WindowsRuntime;
    2. using Wscc = Windows.Security.Cryptography.Core;
    3. using BinaryStringEncoding = Windows.Security.Cryptography.BinaryStringEncoding;
    4. using CryptographicBuffer = Windows.Security.Cryptography.CryptographicBuffer;
    5. using CryptographicEngine = Windows.Security.Cryptography.Core.CryptographicEngine;
    6. using CryptographicKey = Windows.Security.Cryptography.Core.CryptographicKey;
    7. using MacAlgorithmNames = Windows.Security.Cryptography.Core.MacAlgorithmNames;
    8. using MacAlgorithmProvider = Windows.Security.Cryptography.Core.MacAlgorithmProvider;
    9. using IBuffer = Windows.Storage.Streams.IBuffer;
    1.     Wscc.HashAlgorithmProvider hashAlgo = Wscc.HashAlgorithmProvider.OpenAlgorithm(Wscc.HashAlgorithmNames.Sha256);
    2.     using (System.Security.Cryptography.HashAlgorithm hashAlgo = new System.Security.Cryptography.SHA256Managed())
    3.         IBuffer input = CryptographicBuffer.ConvertStringToBinary(“Example”, BinaryStringEncoding.Utf8);
    4.         byte[] hashBytes = hashAlgo.HashData(input).ToArray();
    5.         byte[] input = System.Text.Encoding.UTF8.GetBytes(“Example”);
    6.         byte[] hashBytes = hashAlgo.ComputeHash(input);

    Consider using HMAC-SHA256 instead of plain SHA256 with home-made salting.

  3. Thank you, I’ll try this and let you know.