sha1

Google Cloud Messaging: How to use SHA1 certificate?

流过昼夜 提交于 2019-12-12 10:06:56
问题 I have a doubt. I developed an Android App which receives push notifications via Google Cloud Messaging. Here are the steps I took: Creation of new Project on Google Developer console and copy/paste my Project Number in my android app. Registration of my App through RegID previously received by Google Cloud Messaging. Result: Ok! My App appears in database on my server. Copying/paste Api Key in my Server. I obtained my Api Key from Google Developer Console (Projcet/API/Credential/New API Key)

MS CryptoAPI doesn't work on Windows XP with CryptAcquireContext()

泄露秘密 提交于 2019-12-12 09:52:00
问题 I wrote some code using the Microsoft CryptoAPI to calculate a SHA-1 and got the compiled exe working on Windows 7, Win Server 2008, Win Server 2003. However, when I run it under Windows XP SP3, it does not work. I narrowed down the failure to the CryptAcquireContext() call. I did notice that a previous post talked about the XP faulty naming of " … (Prototype) " and it must be accounted for by using a WinXP specific macro MS_ENH_RSA_AES_PROV_XP. I did the XP specific code modifications and it

Is there an equivalent to SHA1() in MS-SQL?

坚强是说给别人听的谎言 提交于 2019-12-12 09:28:34
问题 Converting a couple stored procedures from MySQL to Microsoft SQL server. Everything is going well, except one procedure used the MySQL SHA1() function. I cannot seem to find an equivalent to this in MS-SQL. Does anyone know a valid equivalent for SHA1() on MS-SQL? 回答1: SQL Server 2005 and later has the HashBytes() function. 回答2: If you want to get a SHA1 hash exactly as MySQL would generate it (i.e. as a varchar), you can combine HashBytes with sys.fn_varbintohexsubstring. E.g. SELECT sys.fn

mysql_real_escape_string causes problems?

别说谁变了你拦得住时间么 提交于 2019-12-12 05:35:21
问题 Okay. So I made a form. If I put in mysql_real_escape_string on my variable $usrname (yes its spelled right) that was retrieved from the form, it returns my other variable, $verify as false . Take a look: <html> <body> <?php session_start(); include("mainmenu.php"); $usrname = $_POST['usrname']; $password = sha1($_POST['password']); $con = mysql_connect("localhost", "root", "Y0U_C@NT_H@NDLE_THE_TRUTH!"); if(!$con){ die("Unable to establish connection with host. We apologize for any

How do I store user password with Bcrypt

佐手、 提交于 2019-12-12 05:33:22
问题 I am designing a php website, and I used sha1 to store password for the users, but I later read that sha1 is unsafe, Its better i use Bcrypt, now I try to find about Bcrypt but these questions - How do you use bcrypt for hashing.. and Is Bcrypt used for Hashing is too complex, I dont understand what they explain. <?php $pass = sha1($_POST["password"]); ?> but could it be: <?php $pass = bcrypt($_POST["password"]); ?> or which is better than both. Thanks 回答1: If you are using PHP version 5.5+,

basic mysql sha1 password valid check

为君一笑 提交于 2019-12-12 02:53:59
问题 I am using sha1 function to store my password in mysql DB.. $passwordHash = sha1($password); From google I got this From user registration sha1( sha1(users_plaintext_password)+random string ) To check server computes sha1( users_hashed_password_in_database + $_SESSION['random_string'] ) if $_POST['password'] == sha1( users_hashed_password_in_database + $_SESSION['random_string'] ) My question is how do I check for validation?Is this the correct method?? And does using some random string as

C and hashlib LNK errors

冷暖自知 提交于 2019-12-12 02:25:31
问题 Okay. So i am using Visual Studios 2010 -> Visual C++ and the .NET Framework (Windows Forms Application) and when i try to hash a string with the hashlib++ i get multiple LNK errors. This is hashlib++ : http://hashlib2plus.sourceforge.net/ This is my code for the hash: //I have more Includes but according to http://hashlib2plus.sourceforge.net/example.html these are the only ones required for hashlib++ so these are the ones i am putting on display. #include <string> #include <iostream>

SHA1: different results for PHP and C#

牧云@^-^@ 提交于 2019-12-12 02:08:11
问题 I have a code to generate hash in C#: string hash = GetHash("Ю-41241624.05.1991"); public static string GetHash(string str) { Encoding eu = Encoding.UTF8; byte[] data = eu.GetBytes(str); SHA1 sha = new SHA1CryptoServiceProvider(); return Convert.ToBase64String(sha.ComputeHash(data)); } The result is: G7xY+gb35Lw4HlDnTZP89FU3Khk= And I try to get the same result in PHP: $str = mb_convert_encoding("Ю-41241624.05.1991","UTF-8"); $hash = sha1($str,true); $base64 = base64_encode($hash); echo

SQL Server sha1 value in prepared statement gives a different value than hardcoded string

二次信任 提交于 2019-12-12 01:03:08
问题 I am trying to encrypt a password in SQL Server and I'm getting two different results when I use a string vs. using a prepared statement parameter. For example: SELECT sys.fn_varbintohexstr(HASHBYTES('sha1', ?)), sys.fn_varbintohexstr(HASHBYTES('sha1', 'password')) Where the ? is populated by 'password'. It gives me 0xe8f97fba9104d1ea50479... 0x5baa61e4c9b93f3f06822... Why am I getting two different results for what should be the same thing? Also, this is only happening in SQL Server, if I do

SQL Select Query with CodeIgniter's active records and 'where sha1' returns first row entry

笑着哭i 提交于 2019-12-11 17:33:42
问题 I duplicated this problem on a completely clean installation of CodeIgniter 2.0.2 The following code was added to the default 'welcome' controller, and the I created a 'test_model' to demonstrate the error. The following can be assumed/changes to config/autoload/database: - correct definition of base url - autoload database library - logging set to 4 (all messages) - database connection parameters This is what I added to the controllers/welcome.php: function test_me() { $this->load->model(