Giter Club home page Giter Club logo

crypto's People

Contributors

mattmook avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

crypto's Issues

Can't be used in Swift on non-main thread

Using Swifts async/await feature and Task.detached {} I load some files in the background where I want to calculate the checksum for.

My code looks like this:

                do {

                    let digest = Algorithm.XXH3_128().createDigest().platform()

                    let data = try Data(contentsOf: URL(fileURLWithPath: photo.url))

                    return digest.digest(input_: data)

                } catch {
                    Log.error("Failed creating checksum", error: error)
                }

If I execute that a IncorrectDereferenceException occurs as follows:

Uncaught Kotlin exception: kotlin.native.IncorrectDereferenceException: Trying to access top level value not marked as @ThreadLocal or @SharedImmutable from non-main thread
    at 0   shared                              0x000000010f091b9d ThrowIncorrectDereferenceException + 93
    at 1   shared                              0x000000010f6ffd9b kfun:com.appmattus.crypto.internal.core.xxh3#XXH3_128bits_reset(com.appmattus.crypto.internal.core.xxh3.XXH3_state_s){}com.appmattus.crypto.internal.core.xxh3.XXH_errorcode + 171
    at 2   shared                              0x000000010f6f7833 kfun:com.appmattus.crypto.internal.core.xxh3.XXH3_128#reset(){} + 435
    at 3   shared                              0x000000010f6f7104 kfun:com.appmattus.crypto.internal.core.xxh3.XXH3_128#<init>(com.appmattus.crypto.Algorithm.XXH3_128){} + 276
    at 4   shared                              0x000000010f2acde5 kfun:com.appmattus.crypto.internal.CoreDigest#create(com.appmattus.crypto.Algorithm){}com.appmattus.crypto.Digest<*> + 18277

It works if I wrap that into DispatchQueue.main.async {} which of course causes my UI to hang.

This relates to Kotlin/Native memory model.

Maybe you can see if you can fix it in a way that it can be used on background threads. :)

XChaCha20 - nonce size restrictions

Hi there!
Thanks for your great library.

I have a question: why nonce size in XChaCha20 is strictly 32 in bytes, or NONCE_SIZE == 24.
In my case i need NONCE_SIZE to be eqal to 12.

Encryption with 12 value works fine, but decryption in method hChaCha20 fails with crash.

XXH3_64 implementation gives incompatible hash values for short input lengths

Some short inputs with 1,2, or 3 bytes lead to different hash values compared to the native reference implementation from https://github.com/Cyan4973/xxHash. The behavior can be reproduced with this unit test https://github.com/dynatrace-oss/hash4j/blob/01e8ed429c61acd7735967b2ba472c80d4616337/src/test/java/com/dynatrace/hash4j/hashing/CrossCheckTest.java#L195 which checks the compatibility with the reference implementation.

Support M1

Now as Kotlin 1.5.30 is out it would be nice if you could add the targets macosArm64 and iosSimulatorArm64.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.