Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4617204
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:05:30+00:00 2026-05-22T02:05:30+00:00

I am working on a website for a game. The accounts are created via

  • 0

I am working on a website for a game. The accounts are created via the php based website, and the game login server is being prototyped in Python, and will be finalized in C. The problem I am having is that when I hash something in PHP, I am unable to reproduce the same result with the same starting data and salt in Python. I looked through the algorithm in PHP here http://www.akkadia.org/drepper/SHA-crypt.txt and compared it to the way I was doing it and noticed that PHP cuts off the null byte at the end. Although, other than that I havent had much luck.

Python:

def HashPassword(Salt,Password,Rounds=5000):
    passhash=hashlib.sha512(Password+Salt).digest()[:-1]
    for i in xrange(2,Rounds):
        passhash=hashlib.sha512(passhash+Salt).digest()[:-1]
    return passhash

PHP:

function HashPW($password, $salt = "")
{
    if(strlen($salt) == 0) $salt = RandChar(16);
    return crypt($password, '$6$rounds=5000$' . $salt . '$');
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:05:31+00:00Added an answer on May 22, 2026 at 2:05 am

    Here is some simpler Python code for you.

    import crypt
    def hashPassword(salt, password, rounds=5000):
        return crypt.crypt(password, '$6$rounds={:d}${}$'.format(rounds, salt))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on the website for a mmo-rpg game-based group, and I'm having trouble
I have working website in PHP with a MySQL backend which has several tables
Im working on a website (html,css,javascript, ajax, php,mysql), and I want to restrict the
Copied a working website from one server to another, now I'm getting this error
I already have a working OOP website. Most of the php is separated from
I have a working website on a pre-production server, all functions are responding correctly.
I am working on website, in which i want integrate the facebook login with
I'm working on a flash gaming website. I have two models: Game and User
I am planning on working on a game that has a PHP back-end to
I'm working on creating a basic web based game using the HTML5 canvas and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.