All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jvmMain.com.appmattus.crypto.PlatformData.kt Maven / Gradle / Ivy

The newest version!
/*
 * 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.
 */

package com.appmattus.crypto

/**
 * Represents the native platforms data type for Array like data. For JVM we are using [ByteArray]
 */
@Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING")
public actual typealias PlatformData = ByteArray

/**
 * Convert this [Digest] into a platform specific [PlatformDigest]
 */
internal actual fun > Digest.toPlatform(): PlatformDigest = object : PlatformDigest {
    override fun update(input: Byte) = [email protected](input)
    override fun update(input: PlatformData) = [email protected](input)
    override fun update(input: PlatformData, offset: Int, length: Int) = [email protected](input, offset, length)
    override fun digest(): PlatformData = [email protected]()
    override fun digest(input: PlatformData): PlatformData = [email protected](input)
    override fun digest(output: PlatformData, offset: Int, length: Int): Int = [email protected](output, offset, length)
    override val digestLength: Int get() = [email protected]
    override fun reset() = [email protected]()
    override fun copy(): PlatformDigest = [email protected]().toPlatform()
    override val blockLength: Int get() = [email protected]
    override fun toString(): String = [email protected]()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy