Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Burst/Native Crypto Libraries?

Discussion in 'Burst' started by jasonboukheir, Jul 13, 2021.

  1. jasonboukheir

    jasonboukheir

    Joined:
    May 3, 2017
    Posts:
    80
    Hey there, I'm trying to find a good Burst Compatible or native crypto library. Has anyone used anything like that or tried using a native plugin for it?

    Specifically looking for SHA512 hash and ED25519 Curve signature algorithms.
     
  2. IgreygooI

    IgreygooI

    Joined:
    Mar 13, 2021
    Posts:
    48
    Find a NativePlugin that does that, and generate the C# binding. Burst supports [DllImport]

    For binding generation: I found it is most successful to generate binding from C/C++ header with ClangSharp. The generated bindings are burst-compatible and requires few modifications.
     
    jasonboukheir likes this.
  3. jasonboukheir

    jasonboukheir

    Joined:
    May 3, 2017
    Posts:
    80
    hehehe @Igreygool , thanks so much for the trick with ClangSharp!

    libsodium is portable and nice :)

    If anyone else is looking at doing this, a couple people have built libsodium for unity.

    I'm building it here: https://github.com/CareBoo/unity-libsodium (I'm probably going to rename it to unity-libsodium-builds to make it clear that I'm just using it to build for macos and ios :X)