Library code snippets
T-SQL implementation of SKIPJACK
This source code is an T-SQL implementation of the crypt algorith SKIPJACK as a user function for MS-SQL 2000.
Requirements1. MS SQL 2000
2. Script is case insensitive
FilesRun_Me_First.sql Init scriptSkipJack_Crypt.sql Crypt functionsSkipJack_Dec.sql Decrypt functionssamples.sql SamplesSupport_functions.sql Utility functionscustomer.csv CSV file for import and crypt data
Installation
- Run SQL Query Analyzer
- Logon as Administrator or sa
- Use master database (recomanded)
- Open Run_Me_First.sql and run it (press F5)
- Open support_functions.sql and run it
- Open SkipJack_Crypt.sql and run it
- Open SkipJack_Dec.sql and run it
Support functions
| Name | Parameters | Return | Example |
| Exponential | Root (integer), Exponent(integer) | Big Integer | Exponential(2,3)=2^3=8 |
| SHL * | Number1 (integer), Number2 - (integer) | Big Integer | SHL(5,10)=5*2^10=5120 |
| SHR * | Number1 (integer), Number2 - (integer) | Big Integer | SHR(17,2)=17\2^2=4 |
| StrToNum | String (char[2]) | Integer | StrToNum(‘AB’)=16706 |
| NumToStr | Number (integer) | String (char[2]) | NumToStr(16706)=’AB’ |
* SHL = bitwise shift left, SHR = bitwise shift right
ExamplesPrint dbo.Exponential(2,3)
Print dbo.SHL(5,10)
Print dbo.SHR(17,2)
Print dbo.StrToNum('AB')
Print dbo.NumToStr(16706)
Crypt
| Name | Parameters | Return |
| CryptText | Plain Text (nvarchar[4000]), crypt key (nvarchar[10]) | Crypt text nvarchar(4000) |
SamplePrint dbo.CryptText('Hello World!','Some key')
Decrypt
| Name | Parameters | Return |
| DeCryptText | Crypt Text (nvarchar[4000]), crypt key (nvarchar[10]) | Decrypt text nvarchar(4000) |
SampleDeclare @C nvarchar(4000)
Set @C=dbo.CryptText('Hello World!','Some key')
Print dbo.DeCryptText(@C,'Some key')
For more examples, see sample.sql
Note
Computing size of a crypt text:
Length (Crypt text) = Length (Plain Text) + (Length (Plain text) MOD
8)
Related articles
Related discussion
-
High-Performance .NET Application Development & Architecture
by Manjot Bawa (0 replies)
-
VS.NET/sql server installation problem
by daspeac (4 replies)
-
Research topic in software
by reachsangeethamathew (0 replies)
-
Error Msg Description ?
by morizan (0 replies)
-
How to Change Default exe Icon in C#.net Windows Application
by sonali.terse (2 replies)
Related podcasts
-
Stack Overflow: Podcast #28
This is the twenty-eighth episode of the StackOverflow podcast, where Joel and Jeff discuss Windows Azure, SQL Server 2008 full text search, Bayesian filtering, porn detection, and project management — among other things. Jeff met the inestimable Joey DeVilla aka Accordion Guy...
This thread is for discussions of T-SQL implementation of SKIPJACK.