Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
9f0169c6
Commit
9f0169c6
authored
Feb 04, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix md5
parent
c89076b4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
9 deletions
+5
-9
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/PlatformUtilsJvm.kt
.../jvmMain/kotlin/net/mamoe/mirai/utils/PlatformUtilsJvm.kt
+5
-9
No files found.
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/PlatformUtilsJvm.kt
View file @
9f0169c6
...
@@ -6,10 +6,7 @@ import io.ktor.client.HttpClient
...
@@ -6,10 +6,7 @@ import io.ktor.client.HttpClient
import
io.ktor.client.engine.cio.CIO
import
io.ktor.client.engine.cio.CIO
import
kotlinx.coroutines.CoroutineDispatcher
import
kotlinx.coroutines.CoroutineDispatcher
import
kotlinx.coroutines.asCoroutineDispatcher
import
kotlinx.coroutines.asCoroutineDispatcher
import
kotlinx.io.core.copyTo
import
kotlinx.io.pool.useInstance
import
kotlinx.io.pool.useInstance
import
kotlinx.io.streams.asInput
import
kotlinx.io.streams.asOutput
import
net.mamoe.mirai.utils.io.ByteArrayPool
import
net.mamoe.mirai.utils.io.ByteArrayPool
import
java.io.*
import
java.io.*
import
java.net.InetAddress
import
java.net.InetAddress
...
@@ -24,16 +21,15 @@ actual fun crc32(key: ByteArray): Int = CRC32().let { it.update(key); it.value.t
...
@@ -24,16 +21,15 @@ actual fun crc32(key: ByteArray): Int = CRC32().let { it.update(key); it.value.t
actual
fun
md5
(
byteArray
:
ByteArray
):
ByteArray
=
MessageDigest
.
getInstance
(
"MD5"
).
digest
(
byteArray
)
actual
fun
md5
(
byteArray
:
ByteArray
):
ByteArray
=
MessageDigest
.
getInstance
(
"MD5"
).
digest
(
byteArray
)
fun
InputStream
.
md5
():
ByteArray
{
fun
InputStream
.
md5
():
ByteArray
=
this
.
use
{
val
digest
=
MessageDigest
.
getInstance
(
"md5"
)
val
digest
=
MessageDigest
.
getInstance
(
"md5"
)
digest
.
reset
()
digest
.
reset
()
this
.
asInput
().
copy
To
(
object
:
OutputStream
()
{
this
.
transfer
To
(
object
:
OutputStream
()
{
override
fun
write
(
b
:
Int
)
{
override
fun
write
(
b
:
Int
)
{
b
.
toByte
().
let
{
digest
.
update
(
b
.
toByte
())
digest
.
update
(
it
)
}
}
}
}
.
asOutput
()
)
})
return
digest
.
digest
()
return
digest
.
digest
()
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment