A collection of Kotlin Multiplatform Mobile cryptographic hashing functions.

Overview

crypto

CI status codecov Maven Central

A collection of Kotlin Multiplatform Mobile libraries to aid in mobile app development.

cryptohash: A set of cryptographic (and not so cryptographic) hashing functions.
badge badge badge badge badge badge badge badge

Contributing

Please fork this repository and contribute back using pull requests.

All contributions, large or small, major features, bug fixes, additional language translations, unit/integration tests are welcomed.

License

License

Copyright 2021 Appmattus Limited

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

You might also like...
Kotlinx-murmurhash - Kotlin Multiplatform (KMP) library for hashing using MurmurHash

kotlinx-murmurhash Kotlin Multiplatform (KMP) library for MurmurHash, a non-cryp

A Multiplatform GUI for Hashing, written in Compose for Desktop

HashHash A Multiplatform GUI for Hashing, written in Compose for Desktop Report Bug . Request Feature About The Project HashHash is a Multiplatform Gr

Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.
Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.

Themis provides strong, usable cryptography for busy people General purpose cryptographic library for storage and messaging for iOS (Swift, Obj-C), An

Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.
Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.

Themis provides strong, usable cryptography for busy people General purpose cryptographic library for storage and messaging for iOS (Swift, Obj-C), An

A program analysis tool to find cryptographic misuse in Java and Android.

A program analysis tool to find cryptographic misuse in Java and Android.

Kotlin compiler plugin for converting suspend functions to platform-compatible functions

Kotlin suspend transform compiler plugin Summary Kotlin compiler plugin for generating platform-compatible functions for suspend functions. JVM class

KaMP Kit by Touchlab is a collection of code and tools designed to get your mobile team started quickly with Kotlin Multiplatform.
KaMP Kit by Touchlab is a collection of code and tools designed to get your mobile team started quickly with Kotlin Multiplatform.

KaMP Kit Welcome to the KaMP Kit! About Goal The goal of the KaMP Kit is to facilitate your evaluation of Kotlin Multiplatform (aka KMP). It is a coll

A collection of small utility functions to make it easier to deal with some otherwise nullable APIs on Android.

requireKTX requireKTX is a collection of small utility functions to make it easier to deal with some otherwise nullable APIs on Android, using the sam

A collection of small utility functions to make it easier to deal with some otherwise nullable APIs on Android.

requireKTX is a collection of small utility functions to make it easier to deal with some otherwise nullable APIs on Android, using the same idea as requireContext, requireArguments, and other similar Android SDK methods.

FractalUtils - A collection of utility functions and classes, with an emphasis on game related utilities

A collection of utility functions and classes written in Kotlin. There is some emphasis on utilities useful for games (Geometry, Random, Time, Updating, etc).

🚀🏞💪 Collection of Images, Modifiers, utility functions for Jetpack Compose to expand and enrich displaying, manipulating, scaling, resizing, zooming, and getting cropped ImageBitmap based on selection area

Collection of Images, Modifiers, utility functions for Jetpack Compose to expand and enrich displaying, manipulating, scaling, resizing, zooming, and getting cropped ImageBitmap based on selection area, before/after image to with handle to show partial of both images and more is cooking up

Kotlin Multiplatform Mobile + Mobile Declarative UI Framework (Jetpack Compose and SwiftUI)

Kotlin Multiplatform Mobile + Mobile Declarative UI Framework (Jetpack Compose and SwiftUI)

KMM RSS Reader: an open-source, mobile, cross-platform application built with Kotlin Multiplatform Mobile.
KMM RSS Reader: an open-source, mobile, cross-platform application built with Kotlin Multiplatform Mobile.

KMM RSS Reader This is an open-source, mobile, cross-platform application built with Kotlin Multiplatform Mobile. It's a simple RSS reader, and you ca

Multiplatform UI DSL with screen management in common code for mobile (android & ios) Kotlin Multiplatform development
Multiplatform UI DSL with screen management in common code for mobile (android & ios) Kotlin Multiplatform development

Mobile Kotlin widgets This is a Kotlin MultiPlatform library that provides declarative UI and application screens management in common code. You can i

Collection of Kotlin APIs/tools to make using Realm Mobile database easier

Compass Kotlin API and tools to make working with Realm easier Components Compass is designed to make working with Realm easier through collection of

An awesome collaborative collection of Kotlin Multiplatform libraries

Awesome Kotlin Multiplatform Awesome Projects Updated 33 November 21, 2021 Contents Guides Dependency Injection Database NoSQL SQL Extension Reactive

Opinionated Redux-like implementation backed by Kotlin Coroutines and Kotlin Multiplatform Mobile

CoRed CoRed is Redux-like implementation that maintains the benefits of Redux's core idea without the boilerplate. No more action types, action creato

An app architecture for Kotlin/Native on Android/iOS. Use Kotlin Multiplatform Mobile.
An app architecture for Kotlin/Native on Android/iOS. Use Kotlin Multiplatform Mobile.

An app architecture for Kotlin/Native on Android/iOS. Use Kotlin Multiplatform Mobile. 项目架构主要分为原生系统层、Android/iOS业务SDK层、KMM SDK层、KMM业务逻辑SDK层、iOS sdkfra

Mobile client for official Nextcloud News App written as Kotlin Multiplatform Project
Mobile client for official Nextcloud News App written as Kotlin Multiplatform Project

Newsout Android and iOS mobile client for Nextcloud news App. The Android client is already available to download in the Play Store. F-Droid and Apple

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

    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. :)

    opened by AshStefanOltmann 6
  • XXH3_64 implementation gives incompatible hash values for short input lengths

    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.

    opened by oertl 1
  • Add cryptohash to kmm-awesome GitHub project

    Add cryptohash to kmm-awesome GitHub project

    Create PR into https://github.com/terrakok/kmm-awesome so the library is better known.

    From a cryptohash perspective we already implement various algorithms that have feature requests in the krypto library:

    • https://github.com/korlibs/korge/issues/628
    • https://github.com/korlibs/korge/issues/626
    • https://github.com/korlibs/korge/issues/621
    opened by mattmook 0
Releases(0.10.1)
Owner
Appmattus Limited
Appmattus Limited
A program analysis tool to find cryptographic misuse in Java and Android.

A program analysis tool to find cryptographic misuse in Java and Android.

null 92 Dec 15, 2022
Android permissions as suspend functions

Warden Permission handling in Android can be complicated. It requires boilerplate code to setup the permission request, receive the result and then fo

Alex Styl 183 Nov 2, 2022
A collection of android security related resources

android-security-awesome A collection of android security related resources. Tools Academic/Research/Publications/Books Exploits/Vulnerabilities/Bugs

Ashish Bhatia 6.6k Jan 5, 2023
BlackDex is an Android unpack tool, it supports Android 5.0~12 and need not rely to any environment. BlackDex can run on any Android mobile phones or emulators, you can unpack APK File in several seconds.

BlackDex is an Android unpack tool, it supports Android 5.0~12 and need not rely to any environment. BlackDex can run on any Android mobile phones or emulators, you can unpack APK File in several seconds.

null 4.3k Jan 2, 2023
A runtime mobile application analysis toolkit with a Web GUI, powered by Frida, written in Python.

___ ___ / | \ ____ __ __ ______ ____ / ~ \/ _ \| | \/ ___// __ \ \ Y ( <_> )

NCC Group Plc 1.2k Dec 21, 2022
Mobile Security Framework (MobSF)

Mobile Security Framework (MobSF) is an automated, all-in-one mobile application (Android/iOS/Windows) pen-testing, malware analysis and security assessment framework capable of performing static and dynamic analysis.

Mobile Security Framework 13.2k Jan 4, 2023
Compose Multiplatform Application

Compose Multiplatform Application Desktop ./gradlew run - run application ./gradlew package - package native distribution into build/compose/binaries

null 0 Nov 21, 2021
🔓 Kotlin version of the popular google/easypermissions wrapper library to simplify basic system permissions logic on Android M or higher.

?? Kotlin version of the popular google/easypermissions wrapper library to simplify basic system permissions logic on Android M or higher.

Madalin Valceleanu 327 Dec 30, 2022
Secure Secret Keys With Kotlin

Secure-Secret-Keys How to Secure Secrets ?? in Android CMake — Native Libraries

Muhammad Shams 4 Jan 21, 2022
A RSA Cipher implementation for Kotlin/Java

A RSA Cipher implementation for Kotlin/Java.

Lyzev 3 Aug 22, 2022