password-protection

If I make the SALT random for each user, how do I authenticate them?

非 Y 不嫁゛ 提交于 2019-12-04 08:59:07
问题 I've been reading up on the benefits of salting and hashing passwords, but one thing still eludes me... When I provide a random salt for each user, how do I then know what the salt was when I try to authenticate them to login? so if I do.. HASHPW = PW.RANDOMNUMBER I could store the random number in the database, but that seems to kill the entire point of adding the salt.. doesn't it? I could also use a non random number for each salt, but then that also kills the point of the salt because if

How can I avoid hardcoding the database connection password?

孤街醉人 提交于 2019-12-04 08:09:43
I am working on a school-project (writing a website) and I ran into the problem of providing the password for the connection to our database. Because of our Open-Source license we have to publish the sourcecode but that would mean that everyone could connect to the database and see tha data. Currently our connection (a php file) looks like this: $host="************"; $password="************"; $this->conn = new mysqli($host, $user, $password, $dbname).mysqli_connect_error()); Now my question is: how can i provide the password to connect to the database without needing to write $password=... ?

PHP and MySQL - how to avoid password in source code? [duplicate]

青春壹個敷衍的年華 提交于 2019-12-04 07:25:53
问题 This question already has answers here : How to secure database passwords in PHP? (16 answers) Closed 6 years ago . I have a small PHP application storing data in a MySQL database. Currently username / password are hard-coded in the PHP code. A situation I do not really like, for example, since the code is also available in a repository. The best idea I have is to move the data from the code to a configuration file (excluded from the repository), and somehow encode it, so is not directly

PHP - hash_pbkdf2 function

百般思念 提交于 2019-12-04 05:57:13
I'm trying to do a function to hash passwords with this php function: http://be.php.net/manual/en/function.hash-pbkdf2.php . Here is the code: $hash_algo = "sha256"; $password = "password"; $salt = "salt"; $iterations = 1; $length = 1; $raw_output = false; $hash = hash_pbkdf2($hash_algo, $password, $salt, $iterations ,$length ,$raw_output); echo $hash; I got this error: Fatal error: Call to undefined function hash_pbkdf2(). How can the function be undefined??? PS: All the values of my variables are set just for testing the function. Obviously the salt will not be "salt", etc. EDIT : As of PHP

VBA - Check if a workbook is protected before open it

大兔子大兔子 提交于 2019-12-04 05:52:56
Is there a way to check if a workbook is protected before try to open it. Here is my code but I have no Idea of the way (if it is possible) Sub MySub() Dim Wb As Workbook For i = 14 To Cells(Rows.Count, 1).End(xlUp).Row 'I Would like to check if the workbook is Protected here Set Wb = GetObject(Cells(i, 4).Value) Wb.Open End Sub Note : In this code Cells(i,4).Value will be equal to the workbooks path.. Had a bit more of a think about this and came up with the following - although will need a lot more testing and probably a bit of modification. I don't like that the default result is that it is

Cronjob with password protected site (.htaccess)

不问归期 提交于 2019-12-04 04:03:50
I want to create a cronjob that every X time goes to open a webpage. This webpage is password protected by .htaccess (user=admin, passwor=pass). The instruction I give is the following: wget --user=admin --password='pass' http://www.mywebsite.com/test.php But cron gives me the following error: --2012-05-02 10:14:01-- http://www.mywebsite.com/test.php Resolving www.mywebsite.com... IP Connecting to www.mywebsite.com|IP|:80... connected. HTTP request sent, awaiting response... 401 Authorization Required Reusing existing connection to www.mywebsite.com:80. HTTP request sent, awaiting response...

BadPasswordException when filling out pdf with iTextSharp

我与影子孤独终老i 提交于 2019-12-04 04:02:16
I have a third-party PDF file with some form fields, that I need to fill out programmatically. PDF file is secured. Detailed security settings: SecurityMethod: Password Security, Document Open Password: No, ... Form Field Fill-in or Signing: Allowed... When I'm trying to open and fill out the document manually, everything is ok, and I'm not asked for any password. But with the code, it fails with exception. Here's the code (I'm using iTextSharp library): var str = new MemoryStream(); var reader = new PdfReader(_path); var stamper = new PdfStamper(reader, str); Creating the PdfStamper object

Drupal 7 password hash

二次信任 提交于 2019-12-03 21:48:13
I have a bit of a dilemma here. I have a drupal 7 database table of users, with corresponding passwords. All these passwords have been naturally encrypted. My assumption is that these are MD5 hashes, but not quite. The challenge here is that, we are utilizing the same set of users in a companion website that uses similar credentials but a different technology [please don't blame me for this, I a mere pawn]. Now if I knew how Drupal goes about encrypting its passwords, maybe I could decrypt them and apply the same in my backend logic? Note that these passwords are hashed , not encrypted. The

How to use password to decode a string?

最后都变了- 提交于 2019-12-03 21:25:31
I have one password which needs to be travelled across network. So for the safety side I have encoded from transmitting end and doing decoding at receiving end. But my friend still able to breach password on the network because he know that how I have encoded the password string. Here is my code package org; import java.util.Base64; public class EncodingString { public static void main(String[] args){ String str = "I'm Encoding then decoding"; byte[] bytesEncoded = Base64.getEncoder().encode(str.getBytes()); System.out.println(bytesEncoded); String EncodedPassword = new String(bytesEncoded);

PHP different one way hashes for password security

不羁岁月 提交于 2019-12-03 21:13:33
I was wondering to hash the password in PHP using different methods available and the combination of them for more and more security. I was wondering if this would work..? $pass = "***"; $salt = "!@)#%%@(#&@_!R151"; $pass = sha1($pass.$salt); $pass = md5($pass); Rather than that, you can use a stronger hashing algorithm like sha512 with combination of a strong salt and UserID : Do it like this: echo hash('sha512', 'MyPassword' . $StrongSalt . $UserID); SHA512 is actually SHA-2 for which there are no collisions found. See at wikipedia . Nope. Combinations do not add any security. Actually you