109856135e35c069bab58e7487ccfc733b9a6811cBo Zhu/* 209856135e35c069bab58e7487ccfc733b9a6811cBo Zhu * Copyright (C) 2018 The Android Open Source Project 309856135e35c069bab58e7487ccfc733b9a6811cBo Zhu * 409856135e35c069bab58e7487ccfc733b9a6811cBo Zhu * Licensed under the Apache License, Version 2.0 (the "License"); 509856135e35c069bab58e7487ccfc733b9a6811cBo Zhu * you may not use this file except in compliance with the License. 609856135e35c069bab58e7487ccfc733b9a6811cBo Zhu * You may obtain a copy of the License at 709856135e35c069bab58e7487ccfc733b9a6811cBo Zhu * 809856135e35c069bab58e7487ccfc733b9a6811cBo Zhu * http://www.apache.org/licenses/LICENSE-2.0 909856135e35c069bab58e7487ccfc733b9a6811cBo Zhu * 1009856135e35c069bab58e7487ccfc733b9a6811cBo Zhu * Unless required by applicable law or agreed to in writing, software 1109856135e35c069bab58e7487ccfc733b9a6811cBo Zhu * distributed under the License is distributed on an "AS IS" BASIS, 1209856135e35c069bab58e7487ccfc733b9a6811cBo Zhu * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1309856135e35c069bab58e7487ccfc733b9a6811cBo Zhu * See the License for the specific language governing permissions and 1409856135e35c069bab58e7487ccfc733b9a6811cBo Zhu * limitations under the License. 1509856135e35c069bab58e7487ccfc733b9a6811cBo Zhu */ 1609856135e35c069bab58e7487ccfc733b9a6811cBo Zhu 1709856135e35c069bab58e7487ccfc733b9a6811cBo Zhupackage android.security; 1809856135e35c069bab58e7487ccfc733b9a6811cBo Zhu 1909856135e35c069bab58e7487ccfc733b9a6811cBo Zhu/** 2009856135e35c069bab58e7487ccfc733b9a6811cBo Zhu * A Java wrapper for the JNI function to perform the password hashing algorithm SCRYPT. 2109856135e35c069bab58e7487ccfc733b9a6811cBo Zhu * 2209856135e35c069bab58e7487ccfc733b9a6811cBo Zhu * @hide 2309856135e35c069bab58e7487ccfc733b9a6811cBo Zhu */ 2409856135e35c069bab58e7487ccfc733b9a6811cBo Zhupublic class Scrypt { 2509856135e35c069bab58e7487ccfc733b9a6811cBo Zhu 2609856135e35c069bab58e7487ccfc733b9a6811cBo Zhu native byte[] nativeScrypt(byte[] password, byte[] salt, int n, int r, int p, int outLen); 2709856135e35c069bab58e7487ccfc733b9a6811cBo Zhu 2809856135e35c069bab58e7487ccfc733b9a6811cBo Zhu /** Computes the password hashing algorithm SCRYPT. */ 2909856135e35c069bab58e7487ccfc733b9a6811cBo Zhu public byte[] scrypt(byte[] password, byte[] salt, int n, int r, int p, int outLen) { 3009856135e35c069bab58e7487ccfc733b9a6811cBo Zhu return nativeScrypt(password, salt, n, r, p, outLen); 3109856135e35c069bab58e7487ccfc733b9a6811cBo Zhu } 3209856135e35c069bab58e7487ccfc733b9a6811cBo Zhu} 33