본문 바로가기
728x90
반응형

암호화4

spring boot Pbkf2PasswordEncoder 속도 빠르게 하기 방법 1. parameter만 바꾸기 (추천) WebSecurityBeanFactory.java import com.google.common.base.Charsets; import com.google.common.hash.Hashing; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springfra.. 2021. 4. 9.
SHA1 vs SHA2 차이점 SHA-1 SHA-1은 160자로 hash한다 SHA-2 SHA-2는 보통 256자로 해쉬한다. (SHA-256) SHA-224, SHA-384, SHA-512 또한 SHA-2이다. www.thesslstore.com/blog/difference-sha-1-sha-2-sha-256-hash-algorithms/ What is the Difference Between SHA-1, SHA-2 and SHA-256? An in-depth look at hashing algorithms, how they relate to SSL Certificates and what it means when we discuss SHA-1, SHA-2 and SHA-256. www.thesslstore.com 2021. 4. 5.
AES256/ base64 암호화 with java build.gradle dependencies { ... implementation 'org.springframework.boot:spring-boot-starter-security' } AES_Encryption.java import java.io.ByteArrayOutputStream; import java.security.SecureRandom; import java.security.spec.AlgorithmParameterSpec; import java.util.Arrays; import java.util.Base64; import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.spec.IvParameterSpec;.. 2021. 4. 2.
AES256/ base64 암호화 with python 1. install pycrytpodome pip install pycryptodome 2. python class import base64 from Crypto import Random from Crypto.Cipher import AES class AES256(): def __init__(self, key): self.bs = 128 self.key = key.encode('utf-8') self.key = AES256.str_to_bytes(key) @staticmethod def str_to_bytes(data): u_type = type(b''.decode('utf8')) if isinstance(data, u_type): return data.encode('utf8') return data d.. 2020. 3. 30.
728x90