473,804 Members | 3,113 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Generate Key using Cipher Block Chaining MAC

31 New Member
I want to encrypt the ASCII message using Cipher Block Chaining MAC and generate the 8 byte key.How can i achieve this?
Thanks:
Danish Majid
May 21 '07
20 6067
danishce
31 New Member
Basically i am developing a message interface document and send/receive data to server from my application using winsock TCP/IP. There is a MAC field in the document which apply CBC MAC encryption to plain text that i send to server and return 8 byte key in output.Then i send this 8 byte key with my plain text and the server check my message with their interface. At the server end their is a third party involved which developed server interface so they check my message and gives reply to me either transaction is OK/CANCEL.
When i am using TripleDES it generate 8 byte MAC Key but i want to generate CBC MAC key using DES.The code for TripleDES key is:
dim plaintext as string
plainText = "46546544798752 123449879843132 187984132146546 4"
Dim data As Byte() = ASCIIEncoding.A SCII.GetBytes(p lainText)
Dim mac3des As New MACTripleDES
Dim result As Byte() = mac3des.Compute Hash(data)
output=(result= 52637299) 8 byte

Code for DES key is:
'Dim DES As New DESCryptoServic eProvider
'' Set the cipher mode.
'DES.Mode = CipherMode.CBC
'Dim data As Byte() = ASCIIEncoding.A SCII.GetBytes(p lainText)
'If key Is Nothing Then
' DES.GenerateKey ()
' DES.GenerateIV( )
' key = DES.Key
' iv = DES.IV
'Else
' DES.Key = key
' DES.IV = iv
'End If

'Dim DESEncrypt As ICryptoTransfor m = DES.CreateEncry ptor()
'Dim ms As New MemoryStream
'Dim cs As CryptoStream = New CryptoStream(ms , DESEncrypt, CryptoStreamMod e.Write)
'cs.Write(data, 0, data.Length)
'cs.FlushFinalB lock()
'ms.Position = 0
'Dim result(ms.Lengt h - 1) As Byte
'ms.Read(result , 0, ms.Length)
'cs.Close()
'Dim keyout As Byte()
'keyout = result
output=same length as plain text,i want keyout should be 8 byte.
I hope you understand this.
Jun 1 '07 #21

Sign in to post your reply or Sign up for a free account.

Similar topics

4
3143
by: hopehope_123 | last post by:
Hi , Where can i find information about db2 block structure? I want to know how it stores rows into blocks , how it handles issues such as row migration / chaining or etc. Kind Regards, hope
5
6782
by: Michael Sperlle | last post by:
Is it possible? Bestcrypt can supposedly be set up on linux, but it seems to need changes to the kernel before it can be installed, and I have no intention of going through whatever hell that would cause. If I could create a large file that could be encrypted, and maybe add files to it by appending them and putting in some kind of delimiter between files, maybe a homemade version of truecrypt could be constructed. Any idea what it...
6
1497
by: nickdu | last post by:
I usually try to stay away from _alloca(). However, I'm considering using it for a logging function. Our current logging function maintains its own buffer which it grows to fit the string being logged. To work correctly in a multi-threaded environment there are locks around the code which log the string. We could remove the locks and just allocate on the heap, but then we could run into heap contention and heap fragmentation. We could...
2
7298
by: Julio C. Hernandez Castro | last post by:
Dear all, We have just developped a new block cipher called Raiden, following a Feistel Network structure by means of genetic programming. Our intention now consists on getting as much feedback as possible from users, so we encourage you to test the algorithm and send us your opinion. We would also like to receive enhancements and new versions of the algorithm, developed in other source languages and platforms. Our idea on developing...
2
7696
by: Bernard Dhooghe | last post by:
The information center writes: "Encryption Algorithm: The internal encryption algorithm used is RC2 block cipher with padding, the 128-bit secret key is derived from the password using a MD2 message digest. " and also explains how the length of the encrypted column can be derived.
0
2311
by: yaipa | last post by:
I snipped this bit of code out of Andrew Kuchling 'pyCrypto' test fixture. Having a need to XOR Binascii Hex strings in my current project, I found it very helpful to cut down on a bit of code clutter. So if you have a need for a Crypto module, this one seems to work off the self without much effort and it comes /w a nice XOR function too boot. :-) PyCrypto can be found at: http://www.amk.ca/python/code/crypto
2
10078
by: danishce | last post by:
Hi, I need to calculate the Cryptographic checksum using ISO/IEC 9797-1 MAC algorithm with cipher block chaining MAC. The resultant MAC length must be 8 bytes. As a sample, the data I am working on now is: Data = '72C29C2371CC9BDB65B779B8E8D37B29ECC154AA56A8799FAE2F498F76ED92F2' Kmac = '7962D9ECE03D1ACD4C76089DCE131543' Resultant MAC(Data)='53265320' (I want to know how to get
4
10219
by: wagn31 | last post by:
i need to use a cipher but I have to used the assigned code in the ciphering i know how to do it, but i am not sure how to add my own dictionary. Here is what i have so far:
12
344
by: iu2 | last post by:
Hi I'm trying to make a method call automatically to its super using this syntax: class A: chained = def pr(self): print 'Hello from A'
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10332
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10321
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9152
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7620
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6853
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5522
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.