MD5 hashing in Android

前端 未结 16 1997
醉梦人生
醉梦人生 2020-11-29 18:06

I have a simple android client which needs to \'talk\' to a simple C# HTTP listener. I want to provide a basic level of authentication by passing username/password in POST r

16条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-29 19:03

    I have made a simple Library in Kotlin.

    Add at Root build.gradle

    allprojects {
            repositories {
                ...
                maven { url 'https://jitpack.io' }
            }
        }
    

    at App build.gradle

    implementation 'com.github.1AboveAll:Hasher:-SNAPSHOT'
    

    Usage

    In Kotlin

    val ob = Hasher()
    

    Then Use hash() method

    ob.hash("String_You_Want_To_Encode",Hasher.MD5)
    
    ob.hash("String_You_Want_To_Encode",Hasher.SHA_1)
    

    It will return MD5 and SHA-1 Respectively.

    More about the Library

    https://github.com/ihimanshurawat/Hasher

提交回复
热议问题