Hashbytes to string sql server. They are all hashing algorithms, not encryption algorithms.
Hashbytes to string sql server Function HashBytes returns VARBINARY; use CONVERT function to convert the binary to string: SELECT I work on sql server 2017 i have field nvarchar(max) store values hashbytes suppose i have text as username:sayed password:321 and i hash it by using hashbyte so after hashing by using hashbyte i need to extract data from it meaning i need Otherwise, consider using HashBytes instead. varbinary (máximo de 8000 bytes) Observaciones. To generate a reasonably large seed value pool, you can use the hour, minute, second, and millisecond values from the current time. First we will try to understand what MD5 is. The first argument of fn_varbintohexsubstring tells it to add 0xF as the prefix or not. Return hexadecimal string. HashBytes() in SQL Server 2016 . So the number of bytes returned by hashbytes function exceeds 8 bytes, but we can use more than one bigint column to store complete information by hashbytes. In fact, this round trip only works because the BASE64 encoding which the function does is also UTF-16. dbo. Taking md2 as example, 16 bytes can be stored using two bigint columns. 20000 is not a max This would reduce the number of calls to either HASHBYTES or SQL#. HASHBYTES function. Its significance lies in ensuring data integrity and enabling change detection within databases. HashBytes' result depends on the input text’s data type and can at the first glance give a bit different results that we might think, especially when combined with the . (hashbytes('SHA1', [Name])) as sha1_from_row ,(hashbytes('SHA1', '1')) as sha1_from_constant , case when [Name] = '1' then 'one' else 'not one' end as checkOne. In that case, you can use the CONVERT function to translate the bytes result of a HASHBYTES to a hex representation as string. HASHBYTES has a 4,000-character limit for NVARCHAR. FYI Hashing is not encrypting. I'm able to reproduce this behaviour with PHP and T-SQL. GetBytes("valuetohash"); byte[] bytes = new SHA512Managed(). Reference for SHA2. Plantéese usar CHECKSUM o This matters particularly because the SQL Server rules for equality are different: HASHBYTES(SHA1, 'Hello ') <> HASHBYTES(SHA1, 'Hello'), but 'Hello ' = 'Hello' as far as T-SQL is concerned. The problem is that I need to retrieve the MD5 of an UTF-8 encoded string just with a SELECT. Understanding the SQL Server HASHBYTES hashing algorithms; Add a Salt You cannot use HASHBYTES() on NVARCHAR(MAX) in SQL Server. SHA-2 is a set of cryptographic hash functions (SHA-224, SHA-256, SHA-384, SHA-512) BigInt has a storage size of 8 byte; 64 byte binary never fits in. SQL Server HASHBYTES function returning un. They are all hashing algorithms, not encryption algorithms. Hot Network Questions Functorial Schröder-Bernstein dBi gain of random wire antennas BJT switch from The HashBytes function in SQL Server SQL Server has a built-in function called HashBytes to support data hashing. Is it possible to do it in a query within SQL Server? I know there's a function to generate hashes in HashBytes(Algo,String), but there's no Base64 option. If you store a hash of a password, and someone hacks the table it's stored To achieve this, I needed to use the HASHBYTES function in SQL Server. Is there a way to generate it directly in SQL Server? this give me the following string (using concatenate function) 2016-01-012016-12-31123456789012000EUR I have MS SQL Server 2012 and when I execute this parts of In SQL Server, is it possible to generate a GUID using a specific piece of data as an input value. SQL Server 2014: HASHBYTES returning different value for same string. With a properly chosen hash algorithm, and by avoiding the SqlBytes data type, you I want to convert a piece of a hash string returned by the HASHBYTES (SHA2_256) function to an integer in MS SQL Server. Another piece of test code to prove that HASHBYTES produce a SQL Server has built-in function HASHBYTES that can be used to calculate hash values. This function doesn't add any new line characters. Edit: Bear in mind that casting I came across this question while looking for a solution to a similar problem while printing the hex value returned from the 'hashbytes' function in SQL Server 2005. You can try it with varchar instead. how can I convert the HASHBYTES return value to a GUID? This is what I have so far. Converting SQL Server HashBytes varbinary to Bigint. Whether that's a good or a bad thing depends on your application, but it needs to be taken into account anyway. This will be our salt. blog - Blog about MS SQL, development and other topics - In short words, hashing is a process of generating a value or values from a string of text using a mathematical function. 2. You should avoid comparison of CHECKSUM values with BINARY_CHECKSUM values. To achieve 100% efficiency, I use the T-SQL HashBytes function for change detection. This (hashbytes('SHA1', '1')) as sha1_from_constant Use master. HASHBYTES accepts VARBINARY in place of In a nutshell, it’s a string (hash value) that defines some data (like a string letters). The supported hash algorithms include MD2, MD4, MD5, SHA, SHA1, SHA2_256 and SHA2_512. Here is a demonstration that shows no matter how big the string is, HASHBYTES is one of the useful functions when it comes to generate hash values on the basis of different types of algorithms. The Setup. Here are the queries that I've made: The HASHBYTES function in SQL Server returns a hash for the input value generated with a given algorithm. First we generate some random salt: Quick thoughts; The HASHBYTES has the 8000 and 4000 character limits for VARCHAR and NVARCHAR data types respectfully. 請考慮使用 CHECKSUM 或 BINARY_CHECKSUM 作為計算雜湊值的替代方案。 從 SQL Server 2016 (13. This particular database is running SQL Server Express, so I'm also curious if this question is version agnostic. Related. HASHBYTES SQL SQL Server SSIS. Just use this function (taken from Hashing large data strings with a User Defined Function): (20), hashbytes(@Algo, @string)) end return @HASH end In SQL Server, HashBytes and VarChar are data types used to store different kinds of information:Stores a fixed-size hash value T-SQL Scripting and String Manipulation. ). Because your inputs are potentially larger than that, duplicates in the range of the field that gets hashed will cause collisions, regardless of the algorithm chosen. Inserting output of hashbytes() function into a table. This approach can be more flexible but also more complex. Implements the given hashing algorithm Edit The MSDN article also explains that the input parameter is either a string or a reference to a variable of type varchar, nvarchar, or varbinary, it is a single input. I won’t go into the details of the HashBytes() function, other than to say that basically you pass in a string or varbinary expression and specify an algorithm for hashing the This cannot be implemented directly in SQL Server, as it doesn't offer such functions. The SQL Server HASHBYTES function is a powerful tool for hashing values using various algorithms like MD5 and SHA. So MS side is using hashbytes MD5, and Oracle is using standard_hash MD5. The encoded string alphabet is that of RFC 4648 Table 1 and might add padding. The value is hashed using the code below: byte[] data = Encoding. fn_varbintohexsubstring(0, HashBytes('SHA1', @input), 1, 0)) I need to generate a SHA256 base 64 hash from a table in SQL server but I can't find that algorithm in the list HASHBYTES arguments. JOIN TableB AS B ON B. Ideally passwords should be hashed only on the client side -- this makes upgrading algorithms easier and also avoids transmitting passwords in the clear to SQL Server. SELECT HASHBYTES('SHA2_512', STRING_AGG(CONCAT( CAST(SPECIFIC_SCHEMA AS It promotes all values passed to it to strings, ignores NULL values, and outputs a single string. Non-reversible, reproducable hashing (like the SQL Server use of MD5) is mainly used for storing things like passwords. Functions summary. HashBytes can use algorithms such as MD5 or SHA1. For more information on the supported collations in Microsoft Fabric, see Tables. Let’s explain the functions briefly. As you noticed, NCHAR and NVARCHAR use UCS-2 rather than UTF-8. Add a comment | 9 . In terms of what size to make it, you can run this query to cast converts between types while you expect a string in a specific format. Person in the TestDB. Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers; Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand; OverflowAI GenAI features for Teams; OverflowAPI Train & fine-tune LLMs; Labs The future of collective knowledge sharing; About the company HASHBYTES (Transact-SQL) Ir al contenido principal Omisión de la experiencia de chat de Ask Learn Este explorador ya no se admite. HASHBYTES. You can't just use cast to get the format you want. How to convert from Hashbytes function's SHA2_256 encryption datatype to varchar(256) in SQL Server 2012. To convert the binary data to hex we need to use the function I've converted all values (I think) over to string values, but I'm afraid there is some MS or Oracle data type that is causing the issue despite my converting to varchar. In the earlier versions, it supports MD2, MD4, MD5, SHA, SHA1 algorithms and these We've got lots of great SQL Server experts to answer whatever question you can come up with. In each case, the database default collation is used. So I decided to compare hex-encoded strings returned by sha2 (SHA-256) function from Snowflake and HASHBYTES (SHA2_256) from SQL Server. Commented Dec 6, 2012 at 13:33. In SQL Server 2017 and later, we can use the function CONCAT_WS. A hash function or algorithm defines the process of how a hash value is created. In contrast, for a case-insensitive server, CHECKSUM returns the same checksum values for those strings. Commented Oct 6, 2014 at 18:48. The HashBytes function returns a binary array of hash data. This means that if one wants to create a hash of character strings larger Whitespace and case should be normalized before calling HASHBYTES, because it is always case-sensitive. If url_safe is true, SQL Server HASHBYTES SHA2_512 and C#. However, it is a pseudo-random number generator that produces the same results if given the same seed. So this means that all the fields from our source records need to be concatenated to a single string; also meaning that all non-string columns need to be converted to a varchar. In these algorithm, SHA-2 (256 and 512) are introduced in SQL Server 2008. HashID = HASHBYTES ( 'SHA1', A. note that second query result equal to 4th query. NET app for example) to compare hashes created outside of SQL Server. Here we discuss what differences exist between them, and how to choose the proper function for a specific use case. This is a very efficient method to compare the string, for an example, lets compare the view definition between two different databases etc. En SQL Server 2014 (12. Unicode). Why BASE64 string is not getting decoded in sql 2012? 8. The WS stands for “with separator”. There are various combination algorithms that can produce arbitrary length material by repeated hash operations, like the PRF of TLS (see RFC 2246). 返回其在 SQL Server 中的输入的 MD2、MD4、MD5、SHA、SHA1 或 SHA2 哈希值。 Transact-SQL 语法约定. NVARCHAR for unicode and VARCHAR for ascii strings. The HashBytes method returns Base64 of the resulting bytes but you can return just the bytes if you prefer them You should use the binary datatype. All Forums SQL Server 2005 Forums Transact-SQL (2005) Express Hexadecimal binary as char: Author what I want in keywords. MSSQL Hashbytes produces different output, string vs column value. Algorithm examples are MD2, MD5, SHA, and SHA_256. In fact fn_varbintohexstr calls fn_varbintohexsubstring internally. Then I’m using the RAND() function to generate a text string of 25 characters. HASHBYTES accepts only 2 parameters (algorithm type, column) SQL Server does not natively support using UTF-8 strings, and it hasn't for quite a while. Once the salt is generated, you can You have "UTF8Encoding" as the name of the column for fn_str_FROM_BASE64, but the resulting string is an nvarchar, which in SQL Server is UTF-16. HASHBYTES() is actually a function which provides access to several hashing algorithms. Is there? Thanks! The SQL Server password hashing algorithm: hashBytes = 0x0100 | fourByteSalt | SHA1(utf16EncodedPassword+fourByteSalt) For example, to hash the password "correct horse battery staple". HashBytes ( '<algorithm>', { @input | 'input' } ) <algorithm>::= MD2 | MD4 | MD5 | SHA | SHA1 | SHA2_256 I'm trying to calculate SHA1 hash of a unicode string using T-SQL. Let's see the usage of the MS SQL function HASHBYTES witch purpose is to hash values. declare @input varchar(50) set @input = 'some text' print 'SHA1 Hash: ' + UPPER(master. 針對 SQL Server 2014 (12. LTRIM(RTRIM(TOLOWER(@value))) This might get difficult though if you have to create a similar algorithm (in an external . 5 AS VARCHAR(64))), 2), 61, 4)) as tmp But when I try to cast it to an int this results in an error: I think you want printable characters. Col3 ); "Do not seek to follow in the footsteps of the wise. add the cast and compare the outputs of the cast. The SQL Server Explanations. It can convert values to MD2, MD4, MD5, SHA, or SHA1 formats. The MD5 message-digest algorithm is a widely used cryptographic hash function producing a 128-bit (16-byte) hash value, typically expressed in text format as a 32 digit hexadecimal number. Possible solutions are: The SQL hashbytes function can use a number of different algorithms, but none of the are reversible. – Michael J Swart. To generate a hash value, a hash function or algorithm is used. Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance Azure Synapse An Returns the MD2, MD4, MD5, SHA, SHA1, or SHA2 hash of its input in SQL Server. You can use binary instead of varbinary because the hash function will always return the same number of bytes for the same type of hash (e. SQL Server - Password Field Encoding. x) 和更早版本,允許的輸入值限制為 8000 個位元組。 傳回值. If this had been MySQL I would most likely not even asked the question, but I just don't know enough about SQL Server outside of the Management Studio yet. If you need encryption and decryption in code, the correct SQL functionality to use is EncryptByKey and DecryptByKey SQL Server has at least three functions to create checksums or hashes: and HASHBYTES(). If I cast the string before hashing it, I get the same results. This will cut down on the (slight) overhead required to manage a variable length binary (varbinary) column. As far as I understand SQL Server offers two datatypes for storing strings - VARCHAR for 8-bit ISO encodings and NVARCHAR for UTF-16. How to Base64 encode extended character With HASBYTES you can create SHA1 hashes, that have 20 bytes, and you can create MD5 hashes, 16 bytes. MS query is pulling in a unique identifier, 2 varchar fields, a date field, and a "money" field. Sql Server Storing SHA256 String as Question Marks. " To properly convert the output of HashBytes to VarChar, you can utilize a combination of built-in functions that SQL Server provides. x) y versiones anteriores, los valores de entrada permitidos tienen un límite de 8000 bytes. Carefully consider the range of data you plan to hash -- using the first 4000 characters is the obvious choice, but may not be the best choice The function must take an input of an NVARCHAR or VARBINARY string (all relevant columns are concatenated together) The typical input size of the string will be 100 - 20000 characters in length. I do not really want to cover the usage or basic information of HASHBYTES in this post, In SQL Server, for simple hash code encryption like password encryption, we can use the HASHBYTES function to encrypt the string. . I had no problems with NVARCHAR strings. Improve this question. Util_HashBinary by half. Sadly in this version of SQL Server, CONVERT does not seem to work at all, only fn_varbintohexsubstring does the correct thing: I did: My actual SQL knowledge is in MySQL and learning TSQL to a functional level is just another thing on my long list to learn/task to complete/etc. I'm trying to generate a hash value of a specific string in MD5 Base64. Previous A Thought on HashBytes function was introduced in SQL server 2005 to simplify creating hashes in the database. Instead, seek what they sought. Getting Started with Hashing. I want to see if the the strings have differences in encoding (eg. Although you might be able to go from the What to Use as a Salt the SQL Server HASHBYTES() function. Using I'm looking for a hash function in Snowflake and SQL Server that returns the same SHA-256 string value. 3. 0. The below code works fine with ASCII strings:. SELECT HashBytes('SHA1', 'SQLSERVER'); The solution presented here is to use the HashBytes SQL Server function to generate a hash code for every source record. Net framework. NET assembly. I create and populate a copy of AdventureWorks2014. The AdventureWorks2014. Concatenate SQL Server Columns into a String with CONCAT() New FORMAT and CONCAT Functions in SQL Server 2012; Concatenate Values Using CONCAT_WS. 適用於:SQL Server 2012 (11. The challenge was that this function used with the SHA2_512 encryption algorithm will return a fixed character length of 64 characters which will be longer than the character length on my destination table. sql-server; sql-server-2012; t-sql; encoding; hashing; Share. The HashBytes() function is primarily intended for hashing values for use within cryptographic situations, but can prove very valuable for change detection of records. One possible explanation is that this online tool calculates the MD5 hash of an UTF8 encoded string. Possible algorithms for this function are MD2, MD4, MD5, SHA, SHA1 and starting with SQL Server 2012 also The HASHBYTES function only takes up to 8000 bytes as input. Use master. This means we could calculate the hash or checksum like this: The real answer is a true hashing function, and in SQL Server that I think you are looking for HASHBYTES, but it supports only up to SHA-1 (160 bytes). I say 'best' because I don't know what is best. MD5 is deprecated anyway, you should use SHA2_512. 语法 SQL 将HashBytes转换为VarChar 在本文中,我们将介绍如何将SQL函数“HashBytes”返回的二进制散列值转换为可读的字符串(VarChar)格式。HashBytes是SQL Server中的一个内置函数,用于计算二进制或字符输入的哈希值。然而,HashBytes返回的是二进制数据,通常不便于直接使用和理解。因此,将其转换为可读的字符串格式是很有价值的。 阅读更多:SQL CAST(HASHBYTES('MD5', 'some long string with up to 256 characters') AS int) CAST(HASHBYTES('SHA2_256', 'some very very long string') AS int) This has been done to generate a unique int value and later the int value is used as a lookup key (or foreign key in a join). You need to specify the desired format, eg using CONVERT – Panagiotis Kanavos. For example, DECLARE @seed1 VARCHAR(10) = 'Test' DECLARE @seed1 VARCHAR(10) = 'Testing' SELECT NEWID(@seed1) -- will always return the same output value SELECT NEWID(@seed2) -- will always return the same output value, and will be different to I am using code like this in my SELECT statement: CAST(HASHBYTES(N'SHA1', Bla) AS NVARCHAR(MAX)) AS hashed_bla and end-up with "chinese"/UTF encoded characters in the ssms grid but also in upstrea Run SQL query with python in SQL Server raises error: SqlSatelliteCall error: Unsupported input data type in column 1 Best way to store encrypted API identifiers (MariaDB) I'm working on a C# project where we have a text value that is placed in a SQL Server database table in a nvarchar field. GetString(bytes); The non-reversable hashing algorithm MD5 is supported in Microsoft SQL Server, but is not directly accessable though a simple transact-SQL function. ComputeHash(data); String result = Encoding. 2) Most RDBMS support both unicode and ascii 😎 You can use SQL Server XQuery Extension Functions and xs:hexBinary base type Constructor Function within a xml value() method to convert the binary data into a hexadecimal string. Keep in mind, a hash is no guarantee for unique values; it's just a hash. As you mentioned in your comment, the solution is to change datatype of your key column. Post navigation. This is a built-in cryptographic function with hashing algorithms like MD-2, MD-4, MD-5, SHA-1, SHA-2 (256 and 512). Encryption is a process that is reversible to get the original data. If you send a BASE64 string in which was encoded as UTF-8, it will not produce the original string. This blog will delve into the intricacies of SQL Server HASHBYTES, from its basic syntax to advanced applications, providing a comprehensive Hi All, how to get back the actual value from the has values generated using the Hashbytes function. Just make sure to pass the value 2 as the third parameter. Compare Hash For example, the strings "McCavity" and "Mccavity" have different BINARY_CHECKSUM values. MD5, SHA1, etc. Your middle initial and the Encyclopædia Galactica could happen to generate the value 0xDEADC0DE when hashed with a given algorithm. Commented Jul 29, 2020 at 10:39. SQL Microsoft SQL Server Administration and T-SQL Programming including sql tutorials, training, MS SQL Server Certification, SQL Server Database Resources. The other MD and SHA1 algorithms Encryption is bidirectional, which means data encrypted can be decrypted back to the original string if you have access to the correct decryption key, whereas hashing is unidirectional, which means hashed data cannot be reversed back to the original string. It is irreversible. x) 和更新版本. CREATE PROCEDURE [dbo]. – Riley . 5. – Lareau. MD5 Hashing in SQL Server. If you do not need the cryptographic properties of the HASHBYTES function, you can consider writing your own SQLCLR function to calculate hash values. fn_varbintohexstr and then substringing the result. The dash Below are two methods that do hashing of string and of bytes. I do not really want to cover the usage or basic information of HASHBYTES in this post, In SQL Server, you can use the RAND() function as a random number generator. The URL-safe output uses the base64url alphabet of RFC 4648 Table 2 and doesn't add padding. Ascii vs. Person table. Technically, you can get around this programmatically, but if your data is longer than 4,000 characters, I’d suggest looking for another way to identify the record. Col2 + A. Valor devuelto. fn_varbintohexstr calls fn_varbintohexsubstring with 1 as the first The built in SQL Server HASHBYTES offers good spread over the the space, but comes a high computation cost. Person. How reliable such a hash would be in the face of collisions, I couldn't say. With the salt generated, it’s a This is SQL Server 2012. HASHBYTES function in SQL Server is used to hash the input using the algorithm specified. CHECKSUM() Case-sensitivity of the strings depends on server configuration. I gonna say 'No', as far as i known, there is no such function to convert SQL Server has built-in function HASHBYTES that can be used to calculate hash values. ASCII. SQL Server has the HASHBYTES inbuilt function to hash the Click to share on X (Opens in new window) X Click to share on Facebook (Opens in new window) Facebook Click to share on LinkedIn (Opens in new window) LinkedIn Click A hash function "is any function that can be used to map data of arbitrary size to fixed-size values. Here’s how you can achieve that: Step-by-Step Write loops that generate passwords, compute hashbytes and compare with the stored hashbytes. Normally you would store the MD5 hash value as a hexadecimal string in your database. Putting It All Together. DECLARE @SomeValue VARCHAR(100) = CONVERT(VARCHAR(100), NEWID()) SELECT @SomeValue AS Original, CONVERT( You can use CONCAT to concatenate all the columns per row, then STRING_AGG to concatenate the whole table, and hash the result. varbinary (最大 8000 位元組) 備註. 1. Ex : for this . [Login] @email nvarchar, @password varchar AS BEGIN DECLARE @passHashBinary varbinary; DECLARE @newPassHashBinary varbinary; -- Create a unicode (utf-16) password Declare @unicodePassword nvarchar; Set @unicodePassword = Damir Matešić . This should be enough to get you started. e. MS SQL function HASHBYTES was introduced in MS SQL version 2005 Using SQL Server 2014 I have a table that has a nvarchar(max) column called [ASCII File] which can contain an ASCII text file of many K. By default, string comparisons during normal SQL operations is case-insensitive (you can modify this with the COLLATION server setting). " It is inherently not a reversible process, nor is the result guaranteed to be unique. x) 開始,已淘汰 MD2、MD4 HASHBYTES function in SQL Server is used to hash the input using the algorithm specified. With a specified MD5 hash algorithm, the probability that HashBytes will return the same result, for two different inputs, is much lower compared to CHECKSUM. Upgrade SQL Server 2008 Express to SQL Server Workgroup 2008 适用于: SQL Server Azure SQL 数据库 Azure SQL 托管实例 Azure Synapse Analytics 分析平台系统 (PDW) Microsoft Fabric 中的 SQL 分析端点 Microsoft Fabric 中的仓库. For advanced scenarios or specific formatting requirements, you can use T-SQL scripting and string manipulation techniques to 1) SQL Server uses which ever type you decide to use, i. Introduction In this Blog we will see how to convert string into MD5 in SQL Server. Person (or any recent version of AdventureWorks) table is the source. Col1 + A. Another option: Lean on SQL Server's CLR integration and perform the hashing in a . SQL Server HASHBYTES and Extended Ascii. This is what I need: I need to express the binary result of an SHA1 HASH brought back from the HASHBYTES function as a literal string I explain this in the video. If you are insistent on using the HASHBYTES function, you must be able to pass the UTF-8 byte[] as VARBINARY from your C# code to preserve the encoding. g. Examples. You are passing in multiple input parameters. The supported hash algorithms include MD2, MD4, MD5, SHA, SHA1, SHA2_256 and DECLARE @varchar varchar(Max); DECLARE @hashbytes varbinary(20) -- Convert 'raresql' string into Hasbytes SET @hashbytes=HASHBYTES('SHA1','raresql'); -- Select Hasbytes value Select SELECT HASHBYTES ('SHA2_512', 'test'); GO SELECT HASHBYTES ('SHA2_512', [Key]) FROM MyTable WHERE [Key] = 'test'; GO You can reproduce the changing both string to NVARCHAR type. I then want to do a MD5 hashbytes on that file and the resultant hash should always be 20 bytes. You would simply join to this table of hashes 今回はSQLServer(T-SQL)を題材にお話しします。 Databaseにデータを保存するとき、素のままではなくHASH化してから保存、というのはよくあるかと思います。 SQLServerには文字列をハッシュ化するHASHBYTESという関数が用意されています。 SQL Server doesn't use utf-8 strings. fn_varbintohexsubstring(0, HashBytes('SHA1', @input), 1, 0) instead of master. This query returns '6BDA' SELECT (SUBSTRING(CONVERT(VARCHAR(64), HASHBYTES('SHA2_256', CAST(12. SQL Server 2005 and up have the following protocols (how you specify them in HASHBYTES is in parentheses): MD 2 (MD2) MD 4 (MD4) MD 5 (MD5) SHA-0 (SHA) SHA-1 (SHA1) SQL Server 2012 introduces these additional hashing algorithms: While you can read and write UTF-16 data into nchar/nvarchar/ntext fields from an application none of the SQL Server string functions will give you correct results in the presence of Supplementary Characters unless the current database is using a Supplementary Character (_SC) collation. pjm lqeezb hnjnt gbpv ukhtf qstuvsb hlmpkv njg bqb rbgblz tztb nnogd ainuk tyqhzr nog