msvisual.com Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Encrypting a text file

 
Post new topic   Reply to topic    msvisual.com Forum Index -> VB Enterprise
Author Message
Klev



Joined: 04 Oct 2007
Posts: 2

PostPosted: Fri Sep 05, 2003 9:10 am    Post subject: Encrypting a text file Reply with quote

I am trying to encrypt the data sent to a text file. How do I do this and
how do I unencrypt it?

Or can someone point me in the right direction.

Any help would be welcome.

Archived from group: microsoft>public>vb>controls>creation
Back to top
View user's profile Send private message
Eduardo A. Morcillo [MS M



Joined: 04 Oct 2007
Posts: 85

PostPosted: Fri Sep 05, 2003 4:26 am    Post subject: Re: Encrypting a text file Reply with quote

> I am trying to encrypt the data sent to a text file. How do I do this
> and how do I unencrypt it?

It depends on how secure you want it to be. The following page contains two
functions which use CryptoAPI to encrypt/decrypt data:

Encrypting data with CryptoAPI
http://www.mvps.org/emorcillo/cod/tips/cryptoapi/encrypt.htm

--
Eduardo A. Morcillo [MS MVP]
http://www.mvps.org/emorcillo
Back to top
View user's profile Send private message
Klev



Joined: 04 Oct 2007
Posts: 2

PostPosted: Fri Sep 05, 2003 10:34 am    Post subject: Re: Encrypting a text file Reply with quote

Eduardo

Is the API freely distributable and how do I get hold of it or is it part of
VB?

Thanks

"Eduardo A. Morcillo [MS MVP]" wrote in message@TK2MSFTNGP11.phx.gbl...
> > I am trying to encrypt the data sent to a text file. How do I do this
> > and how do I unencrypt it?
>
> It depends on how secure you want it to be. The following page contains
two
> functions which use CryptoAPI to encrypt/decrypt data:
>
> Encrypting data with CryptoAPI
> http://www.mvps.org/emorcillo/cod/tips/cryptoapi/encrypt.htm
>
> --
> Eduardo A. Morcillo [MS MVP]
> http://www.mvps.org/emorcillo
>
>
Back to top
View user's profile Send private message
Eduardo A. Morcillo [MS M



Joined: 04 Oct 2007
Posts: 85

PostPosted: Fri Sep 05, 2003 2:01 pm    Post subject: Re: Encrypting a text file Reply with quote

> Is the API freely distributable and how do I get hold of it or is it
> part of VB?

CryptoAPI is part of the operating system. You don't have to distribute it.

--
Eduardo A. Morcillo [MS MVP]
http://www.mvps.org/emorcillo
Back to top
View user's profile Send private message
Douglas Marquardt



Joined: 04 Oct 2007
Posts: 157

PostPosted: Fri Sep 05, 2003 1:49 pm    Post subject: Re: Encrypting a text file Reply with quote

Well... that is the case for newer versions of Windows.
For older versions (Win98, Win NT) you need to ensure that
the users have IE version 3.2 or later with the high encryption pack.

Doug.

"Eduardo A. Morcillo [MS MVP]" wrote in message @TK2MSFTNGP10.phx.gbl...
> > Is the API freely distributable and how do I get hold of it or is it
> > part of VB?
>
> CryptoAPI is part of the operating system. You don't have to distribute it.
>
> --
> Eduardo A. Morcillo [MS MVP]
> http://www.mvps.org/emorcillo
>
>
Back to top
View user's profile Send private message
Simon Roberts



Joined: 04 Oct 2007
Posts: 2

PostPosted: Mon Sep 08, 2003 2:51 am    Post subject: Re: Encrypting a text file Reply with quote

"Klev" wrote in
@TK2MSFTNGP09.phx.gbl:

> I am trying to encrypt the data sent to a text file. How do I do this and
> how do I unencrypt it?
>
> Or can someone point me in the right direction.
>
> Any help would be welcome.
>
>

You welcome to use my NRG encryption algorthim if you like it is 256bit and
works a bit like a spring. It is based on 5000 year old mathamatics and is
very hard to crack.

the source code for it is available from http://www.ep.net.au/ant/main.htm

If you change any of the variables it is next to impossible even with the
source code to break.


-psyhkal-
Back to top
View user's profile Send private message
Ben Taylor



Joined: 04 Oct 2007
Posts: 67

PostPosted: Tue Sep 09, 2003 6:05 am    Post subject: Re: Encrypting a text file Reply with quote

In case all the other replies were useless, here's a
simple XOR encryption function that you don't have to
license or install additional DLLs. It's the same function
to decrypt as to encrypt, you just have to supply the same
key. The longer the key, the harder it is to crack.


Sub EncryptFile(OldFilePath As String, NewFilePath As
String, Key As String)
Dim ff1 As Long, ff2 As Long
Dim OldBytes() As Byte
Dim NewBytes() As Byte
Dim CurByte As Long, TotBytes As Long
TotBytes = FileLen(OldFilePath)
ReDim OldBytes(1 To TotBytes)
ReDim NewBytes(1 To TotBytes)
Dim KeyLength As Long
Dim KeyPos As Long
If Dir(OldFilePath) = "" Then Exit Sub
KeyLength = Len(Key)
ff1 = FreeFile
Open OldFilePath For Binary Access Read As #ff1
ff2 = FreeFile
Open NewFilePath For Binary Access Write As #ff2
Get #ff1, , OldBytes
For CurByte = 1 To TotBytes
KeyPos = KeyLength + 1 - CurByte + KeyLength *
((CurByte - 1) \ KeyLength)
NewBytes(CurByte) = OldBytes(CurByte) Xor Asc
(Mid$(Key, KeyPos, 1))
Next
Put #ff2, , NewBytes
Close #ff1
Close #ff2
End Sub


Function GetRandomString(StringLength As Long) As String
Static bRandomized As Boolean
If Not bRandomized Then Randomize Timer
GetRandomString = Space(StringLength) 'which will
initially put the string at somewhere
'in memory large enough to hold it all
Dim lgChar As Long
For lgChar = 1 To StringLength
Mid$(GetRandomString, lgChar, 1) = Chr$(Int(255 *
Rnd()))
Next
End Function

>-----Original Message-----
>I am trying to encrypt the data sent to a text file. How
do I do this and
>how do I unencrypt it?
>
>Or can someone point me in the right direction.
>
>Any help would be welcome.
>
>
>.
>

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
How To Get File Size of Remote File Hi every one, I am trying to get file size on a remote computer using vb 6.0. I tried using GetFileSize API, but it rquires File Handle and I do not know how to get File Handle. Please help. I do not want to open file. I am actualy coping file to remote m

Winsock control and EXE file I write an Client-Server application use Winsock control . It work very welll on VB IDE but when I make EXE file anh run it then is hang , please help me , thank answer .

Read EXE File Version ? hi i want read EXE file maked with VB abd know Version ? how i can read EXE file version , like Read File Date and Time i want read version from my VB Best Regards From Tark

Rotate the bitmap file Hi all I want to know that how to use VB to rotate a bitmap file to 45 degree or 180 degree? Million thanks

Rotating a bitmap file Hi all I want to know how to rotate the bitmap file. What i need to do is that I want to pass the bitmap file path, and then call some kinds of rotate function, finally output the rotated bitmap file path. I don't need to see the rotation on the form. Tha
Post new topic   Reply to topic    msvisual.com Forum Index -> VB Enterprise All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group