Skip to content

Instantly share code, notes, and snippets.

View HosseinKurd's full-sized avatar
🎯
Focusing

Hossein Kurd HosseinKurd

🎯
Focusing
View GitHub Profile
@HosseinKurd
HosseinKurd / KotlinUriToFile
Last active October 11, 2021 11:57
Kotlin Uri To File
private fun decreaseImage(context: Context?, uri: Uri) {
// println("$TAG , decreaseImage ...")
context?.let {
// println("$TAG , decreaseImage ${uri.path}")
val byteArray =
IOUtils.toByteArray(it.contentResolver.openInputStream(uri))
// println("$TAG , decreaseImage ${byteArray.size}")
val filename = (uri.lastPathSegment ?: "file_${SystemClock.elapsedRealtime()}")
.replace(":", "_")
@HosseinKurd
HosseinKurd / ChCrypto.java
Created December 9, 2020 11:52 — forked from jidolstar/ChCrypto.java
AES 256 encrypt / decrypt - JAVA, PHP, Kotlin
package chela.spring.core;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.util.Base64;
final public class ChCrypto {
final static Base64.Encoder encorder = Base64.getEncoder();
final static Base64.Decoder decorder = Base64.getDecoder();