Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › PHP With hashing SHA256 salted ?help project due in :(
New Posts  All Forums:Forum Nav:

PHP With hashing SHA256 salted ?help project due in :(

post #1 of 3
Thread Starter 
Im not devoloping the web site for the project but my database stores all passwords which have been HASHED and encoded in base 64 using in java.



Code:
byte[] digest = sha2.digest(password.getBytes("UTF-8"));


Base64.encodeToString(digest, Base64.URL_SAFE + Base64.NO_PADDING + Base64.NO_WRAP)
this method works to logon on the andriod app and desktop app, however I need a PHP version to allow web access to the databse.

Can anyone turn that java in to PHP


Thanks guys/
^3
(11 items)
 
   
CPUMotherboardGraphicsRAM
Intel Core i7 5930K  EVGA x99 Micro EVGA GTX 980 SC ACX 16GB Corsair DDR4 Vengeance LPX Black PC4-21300 
Hard DriveCoolingOSMonitor
500GB Samsung 840 EVO H105 Win 10 ASUS ROG PG279 
KeyboardPowerCase
Ducky Shine 1 MX-Red Corsair AX 860i  Fractal Design Node 804 Black 
CPUGraphicsRAMHard Drive
Core i7 @ 2.6  GT650 16GB of 1600 MHz DDR3L SDRAM 256GB SSD 
OSMonitorKeyboard
Mac OSX Lion Retina Display US layout 
  hide details  
Reply
^3
(11 items)
 
   
CPUMotherboardGraphicsRAM
Intel Core i7 5930K  EVGA x99 Micro EVGA GTX 980 SC ACX 16GB Corsair DDR4 Vengeance LPX Black PC4-21300 
Hard DriveCoolingOSMonitor
500GB Samsung 840 EVO H105 Win 10 ASUS ROG PG279 
KeyboardPowerCase
Ducky Shine 1 MX-Red Corsair AX 860i  Fractal Design Node 804 Black 
CPUGraphicsRAMHard Drive
Core i7 @ 2.6  GT650 16GB of 1600 MHz DDR3L SDRAM 256GB SSD 
OSMonitorKeyboard
Mac OSX Lion Retina Display US layout 
  hide details  
Reply
post #2 of 3
Hey.I'm not good with java at all.can you put that code into pseudo code? I think you need

Password to sha256
salt+sha256
Base 64 encode the sha256 of salt+sha256

Does that make sense? Can you tell me how you apply salt?

From my understanding,

(strtr(base64_encode(hash('sha256', $password+$salt)), '+/', '-_'), '=');
That will base 64 url encode that sha256 of a password and salt.
Good luck
Valery
(13 items)
 
  
CPUMotherboardGraphicsRAM
i5 2500k GA-P67A-UD4-B3 Radeon 7970 Reference G. Skill Sniper 
Hard DriveOptical DriveOSMonitor
Corsair NOVA SSD 64gb + 500gb Storage + 1TB Storag HP DVD burner Windows 7 64bit 37" 1080p60hz 
KeyboardPowerCaseMouse
Razer Blackwidow Ultimate Rosewill Lightning 1000W Single Rail LianLi PC-K58 Razer Spectre 
Mouse Pad
Razer Goliathus Speed 
  hide details  
Reply
Valery
(13 items)
 
  
CPUMotherboardGraphicsRAM
i5 2500k GA-P67A-UD4-B3 Radeon 7970 Reference G. Skill Sniper 
Hard DriveOptical DriveOSMonitor
Corsair NOVA SSD 64gb + 500gb Storage + 1TB Storag HP DVD burner Windows 7 64bit 37" 1080p60hz 
KeyboardPowerCaseMouse
Razer Blackwidow Ultimate Rosewill Lightning 1000W Single Rail LianLi PC-K58 Razer Spectre 
Mouse Pad
Razer Goliathus Speed 
  hide details  
Reply
post #3 of 3
Code:

$digest = sha1($password, true); 
base64_encode(sha1($password, true)); 
Using PHP's sha1() and base64_encode() it returns the same SHA-1 hash as your Java. Note: sha1() encodes each byte of the output as hexadecimal by default, but you can get the raw output by passing true as the second argument.
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › PHP With hashing SHA256 salted ?help project due in :(