Convert A 40 Character SHA1 Hash To A 20 Character?

Mar 17, 2010

I have a legacy MySQL database which stores the user passwords & salts for a membership system. Both of these values have been hashed using the Ruby framework - roughly like this:

hashedsalt =
Digest::SHA1.hexdigest("--#{Time.now.to_s}--#{login}--")
hashedpassword =
Digest::SHA1.hexdigest("#{hashedsalt}:#{password}")

So both values are stored as 40-character strings (varchar(40)) in MySQL. Now I need to import all of these users into the ASP.NET membership framework for a new web site, which uses a SQL Server database. It is my understanding that the the way I have ASP.NET membership configured, the user passwords and salts are also stored in the membership database (in table aspnet_Membership) as SHA1 hashes, which are then Base64 encoded (see here for details) and stored as nvarchar(128) data.

But from the length of the Base64 encoded strings that are stored (28 characters) it seems that the SHA1 hashes that ASP.NET membership generates are only 20 characters long, rather than 40. From some other reading I have been doing I am thinking this has to do with the number of bits per character/character set/encoding or something related.

So is there some way to convert the 40-character SHA1 hashes to 20-character hashes which I can then transfer to the new ASP.NET membership data table? I'm pretty familiar with ASP.NET membership by now but I feel like I'm just missing this one piece. However, it may also be known that SHA1 in Ruby and SHA1 in .NET are incompatible, so I'm fighting a losing battle.

View 2 Replies


Similar Messages:

Forms Data Controls :: Change The Column Name - "Remove First Character And After 3rd Character Insert Colon

Jan 14, 2011

My issue is that , need to change the column name(following format "Remove first character and after 3rd character insert colon") of the gridview (which is binded with XMLTextReader). Without changing directly XML file, Required to change the column name dynamically at runtime .

Performance.xml

<Performance>
<Departments>
<Heading>FS</Heading>
<S0015>1</S0015>
<S0020>2</S0020>
<S0025>5</S0025>
<S0030>5</S0030>
<S0035>6</S0035>
</Departments>
<Departments>
<Heading>BS</Heading>
<S0015>0</S0015>
<S0020>3</S0020>
<S0025>5</S0025>
<S0030>1</S0030>
<S0035>3</S0035>
</Departments>
</Performance>

Heading S0015 S0020 S0025 S0030 S0035
FS 1 2 4 5 6
BS 0 3 5 1 3
Required Format: Remove first character and after 3rd character insert colon (S0015 -- 00:15)

Heading 00:15 00:20 00:25 00:30 00:35
FS 1 2 4 5 6
BS 0 3 5 1 3

View 2 Replies

Web Forms :: Norwegian Character Does Not Show Instead Showing Some Strange Character?

Dec 7, 2010

Norwegian character( å æ ø) does not show instead showing some strange character.

used function below:

utf8 = System.Text.Encoding::get_UTF8();

View 4 Replies

InvalidUserName In CreateUser When Creating User With Character Before The @ Character

Jul 27, 2010

I looked up the msdn documentation and it says that InvalidUserName is thrown when it does not find the username in the database, which is fine because the user I am creating should not exist in the database. If I use test@example.com, it works, but if I try it with test.@example.com, the status from Membership.CreateUser is InvalidUserName.

View 1 Replies

How To Read Character By Character From Text File

Jan 25, 2011

How to read character by character in line from text file?

View 1 Replies

Reading Line Character By Character

Mar 4, 2010

I want to read a line character by character, in the sense I want to read each and every character on the line. can I can make that line as a string. breaking string into substrings ? if possiblw how.? I m unable to start. can anyone give the code.

View 7 Replies

Convert Ascii HTML Code To Character?

Jan 5, 2011

i get some data from imdb using regexwhen getting title like Miller's Crossing and inserting it to my database there is a problemi get data and write on screen Response.Write(imdb.Title) it shows as Miller's Crossing that is the correct onebut after insert it to my database in Title field of table it is shown as Miller's Crossing so i dont want thishow can i convert those special characters when inserting to my datasbase ?

View 2 Replies

C# - Convert The Datetime.Now To Tamil Unicode Character In .NET

Feb 17, 2011

I'm wondering if .NET allow multilanguage support for Datetime?

I'm trying to convert the Datetime.Now value to equal Tamil Unicode character.

View 3 Replies

AJAX :: How To Change "Day Name" In Calendar Extender From "2 Character" To "3 Character" Long Name

Jul 7, 2010

I am using AJAX Toolkit's Calendar extender control.

When the control is rendered on page, the day names are 2 character long and shown as "Su", "Mo", "Tu", "We", "Th", "Fr" and "Sa".

Instead, I want it to be rendered as 3 character long format as "Sun", "Mon", "Tue", "Wed", "Thu", "Fri" and "Sat". note that I further need to localize this application too. So, I probably need some setting that could do the magic instead of overwriting on some server side event to achieve it.

There is probably some settings that I am not aware of.

The code for localizing the Calendar extender is as follows (in case if you need to test).

[code]....

View 3 Replies

How To Route Url With # Character

May 3, 2010

How to route url contains # sharp character like this:

~/page.aspx#/Home

to be:

~/Home

View 2 Replies

Get Last 2 Character Of A Value In Text Box?

Mar 25, 2010

i have a TextBox in my page that user can insert some name in it

i just need the last 3 Character from right side of that the user insert in TextBox

View 7 Replies

Web Forms :: What Is %20 Character In URL

May 7, 2015

i want to know when i am doing url mapping and passing string value and value has space in it then it show %20 for each space in url at time of compilation.how to remove %20..i have already worked with your url mapping code it works but prolem is only %20

View 1 Replies

How To Remove The Character From String

May 14, 2010

my insert query is generated in runtime here i want to remove last ',' character from that string query

my string is below

Insert Into Payroll_AllowanceSettings(EmpID,PFNO,CompanyID,Basic,DA,HRA,CONV,SAll,LeaveAll,OT,Bata,Others,)Values(EmpCS001,1234,1,1,2,3,4,5,6,7,8,9,)

here i want to remove last ', ' character both coloumn fields and value fields how can i remove the characters

View 5 Replies

How To Get Website To Allow The Pipe Character In The URL

Feb 1, 2010

This website [URL] does not accept the pipe character | in the URL

This works [URL]

but this doesn't

[URL]

It looks like the pipe is an issue as

[URL]

works.

I need to stop this because a third party called Omniture needs to access this website automatically with the | in the URL. I cannot ask them to encode the | as they are a big company. They say there is some way to allow the | but I am not sure how.

View 3 Replies

Utf 8 - 3.5 Page Character Encoding?

May 6, 2010

I have a problem in my asp.net 3.5 application (C#) when I try to render in my pages characters like 'è' which are shown in a very strange manner (if i'm lucky i get a ? mark in my web page). in fact Expression Web, when i open my web site, substitutes the è char with &#65533;...How can I tell asp.net that I want to use a particular charset so that i can write in the html source letters like è without using hexadecimal codes??????I tried in the web.config this:inside the system.web namespace of the file but nothing works...

View 1 Replies

What Is The Character Expression For A New Line In C#

Nov 16, 2010

I've got a text box control on a page and I want people to add URLs, one on each line and then split those URLs into an array.

So, I'm trying to split them on the newline character. I've tried:

.split(Environment.Newline)
.split('vbcrlf')
.split(vbcrlf)
.split((char)Environment.Newline)

View 2 Replies

IIS Setting For Wildcard Character?

Mar 10, 2011

Is there any setting changes in IIS to support wildcard character? I am running a web application but IIS does not support wildcard character.

View 1 Replies

Does The Password Have Alphanumeric Character

Apr 12, 2010

My ChangePassword method returns a boolean value indicating whether the change of password has been successful or not. When the user enters a new password, I want to check if the password length is at least 8 and there is at least one non-alphanumeric character(both these parameters specified in the web.config file). If I want to check in my code if the password entered is at least 8 characters, I would write some code like this:

if(newpassword.Length !=8)
{
//do something
}

Like the Length property, is there some property that can check if the password contains at least one non-alphanumeric character?

View 5 Replies

.net - How To Replace HEX Character In An Xml Document

Jun 1, 2010

I'm trying to import an xml file into vb.net XmlDocument but am getting the error:hexadecimal value 0x00, is an invalid character. Line 94, position 1.I'm wondering if there is a way to replace the hex character 0x00he following are lines 92,93,94 the file ends on line 94 the file.

Dim fs As FileStream = File.Open(FileName, FileMode.Open, FileAccess.Read)
Dim buffer(fs.Length) As Byte
fs.Read(buffer, 0, fs.Length)
Dim xmlString As String = System.Text.UTF8Encoding.UTF8.GetString(buffer)
fs.close()

View 2 Replies

Remove String Character In C#?

Jan 19, 2010

how to remove string character in asp.net, im having a string variable string str = "1234, ". i want to remove the comma. its possible ?

View 4 Replies

Add New Line Character In Following Code?

Dec 9, 2010

When i inserting the data in database then there is facility to the user that in multiline textbox he can write sentence in multiple line.So when i am populating the same data the database it populate the data like this :

fffffffffffffffffffffffffffffff<br /> f<br /> f<br /> f<br /> f<br /> f<br /> f<br /> f<br /> f<br /> <br /> ff<br /> f<br /> f<br /> <br /> <br /> <br /> fff

but i want to remove <, > ,br. For this i have used following code but my purpose is not solved. So how to do that:

txtEditorOpportunity.Text = dbReader["DESCRIPTION"].ToString().Replace("<br/>", "
");

View 1 Replies

Regex To Allow Space If Followed By Character?

Feb 2, 2011

I have an asp.net regularexpressionvalidator that I need to match on a textbox. If there is any text, logically the rules are as follows:

The text must be at least three characters, after any trimming to remove spaces.
Characters allowed are a-zA-Z0-9-' /&.

I'm having major pain trying to construct an expression that will allow a space as the thrid character only if there is a fourth non-space character.

My last attempt was:

^[a-zA-Z0-9-'/\&.](([a-zA-Z0-9-'/\&.][a-zA-Z0-9-' /\&.])|([a-zA-Z0-9-' /\&.][a-zA-Z0-9-'/\&.]))[a-zA-Z0-9-' /\&.]{0,}$

but that does not match on 'a a'.

View 2 Replies

Copy Character From One String To Another?

Apr 12, 2010

i am trying to copy character from one string to another. i need to copy only some string like 0 to 5

dim str as string="this is just test"
Dim find
As
char() = ""
str.CopyTo(0, find, 0, str.Length)

getting error like

ERROR: Index and count must refer to a location within the string. Parameter name: destinationIndex

View 9 Replies

C# - Character Replacement In String?

Feb 23, 2011

I do need a working ASP.NET C# code to replace characters in a string.

My following code works fine but in case of input "a" it gives me an output as "678d", but in case of input "c" the output is correct as it is i.e. "8d"... Here it automatically replaces the rest values too. I can see the code is executing in a step by step process... This results me to get an overloaded output.

{
StringBuilder builder = new StringBuilder();
builder.Replace("a", "6b");
builder.Replace("b", "7c");
builder.Replace("c", "8d");
return builder.ToString();
}

Now, I do need to replace "a" as just "6b" and it should not load the rest values.

View 5 Replies

Replacing Last Comma In String With Different Character

Oct 23, 2010

i have a string, and i want to replace the last comma with something else. For instance this is my string;

"Monday, December 6, 9:00 PM"

How do i replace that last comma so it can look like this;

"Monday, December 6 2010 9:00 PM"

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved