By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,827 Members | 1,967 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,827 IT Pros & Developers. It's quick & easy.

RSA source code- (or some other) -please

P: n/a
Hi,

I'm trying to protect some data in tables with encription (you know why,
don't you ;))

I must confess that I'm not very expirienced in writing code, especially
encription code.

Can any one, please , send VB code for access which I can c/p into one
function. It don't have to be RSA, it can be anything which is easy to
use and which will make data in tables unreadeable for non authorized
persons.

Thank you very much
--

Nov 12 '05 #1
Share this Question
Share on Google+
11 Replies


P: n/a
On Thu, 6 May 2004 08:22:30 +0200, Lues <pr****@popmail.com> wrote:

No.
Your request is naive. I can probably design something that meets your
specific requirements, but I have to pay bills as well. I can command
a reasonable fee by virtue of knowing how to do things people like
Lues don't know how to do. By the same token I gladly pay my mechanic
to maintain my car, and I don't expect a freebie from her.

-Tom.

Hi,

I'm trying to protect some data in tables with encription (you know why,
don't you ;))

I must confess that I'm not very expirienced in writing code, especially
encription code.

Can any one, please , send VB code for access which I can c/p into one
function. It don't have to be RSA, it can be anything which is easy to
use and which will make data in tables unreadeable for non authorized
persons.

Thank you very much


Nov 12 '05 #2

P: n/a
In article <lu********************************@4ax.com>,
to*****@no.spam.cox.net says...
..On Thu, 6 May 2004 08:22:30 +0200, Lues <pr****@popmail.com> wrote:
..
..No.
..Your request is naive. I can probably design something that meets your
..specific requirements, but I have to pay bills as well. I can command
..a reasonable fee by virtue of knowing how to do things people like
..Lues don't know how to do. By the same token I gladly pay my mechanic
..to maintain my car, and I don't expect a freebie from her.
..
..-Tom.
..
..
..>Hi,
..>
..>I'm trying to protect some data in tables with encription (you know why,
..>don't you ;))
..>
..>I must confess that I'm not very expirienced in writing code, especially
..>encription code.
..>
..>Can any one, please , send VB code for access which I can c/p into one
..>function. It don't have to be RSA, it can be anything which is easy to
..>use and which will make data in tables unreadeable for non authorized
..>persons.
..>
..>Thank you very much


OK, thank you very much for clearing things for me. I understood that
here people helps each others free of charge, and that is the reason why
this service is so much in use. I also helped somebody free of charge in
things what I do for a living (it don't envolve computer skills) because
I was helped in things that others know better than me. If you are living
from making programs why do you read this group at all. Start yor company
and go for it, make money. Who stops you?

Things what I do with this base is completely non profit, for my purpose
only. I want to protect data in tables from reading and using by my
collegues. Nobody payed me to make this base, it is made only to help me
in what I do every day. If I would like to have profitable program I
would not certainly make it in access. I would buy it from professional
company who know this topics much more than I. That I call investment in
business which is necessary to make.

NHF, but if you can help me, thank you. If not, also thank you.

Best regards,
Nov 12 '05 #3

P: n/a
if this database is just for you to use, why don't you just password
protect it
if this database will be used by you and others, but you don't want
some users to see some data, use ms-access built-in security,
assigning users rights based on login, there's a MS-faq article that
describes how to setup it up
(you just need to try a few times with a test databases to get the
hang of it)

Lues <pr****@popmail.com> wrote in message news:<MP************************@news.tel.hr>...
In article <lu********************************@4ax.com>,
to*****@no.spam.cox.net says...
..On Thu, 6 May 2004 08:22:30 +0200, Lues <pr****@popmail.com> wrote:
..
..No.
..Your request is naive. I can probably design something that meets your
..specific requirements, but I have to pay bills as well. I can command
..a reasonable fee by virtue of knowing how to do things people like
..Lues don't know how to do. By the same token I gladly pay my mechanic
..to maintain my car, and I don't expect a freebie from her.
..
..-Tom.
..
..
..>Hi,
..>
..>I'm trying to protect some data in tables with encription (you know why,
..>don't you ;))
..>
..>I must confess that I'm not very expirienced in writing code, especially
..>encription code.
..>
..>Can any one, please , send VB code for access which I can c/p into one
..>function. It don't have to be RSA, it can be anything which is easy to
..>use and which will make data in tables unreadeable for non authorized
..>persons.
..>
..>Thank you very much


OK, thank you very much for clearing things for me. I understood that
here people helps each others free of charge, and that is the reason why
this service is so much in use. I also helped somebody free of charge in
things what I do for a living (it don't envolve computer skills) because
I was helped in things that others know better than me. If you are living
from making programs why do you read this group at all. Start yor company
and go for it, make money. Who stops you?

Things what I do with this base is completely non profit, for my purpose
only. I want to protect data in tables from reading and using by my
collegues. Nobody payed me to make this base, it is made only to help me
in what I do every day. If I would like to have profitable program I
would not certainly make it in access. I would buy it from professional
company who know this topics much more than I. That I call investment in
business which is necessary to make.

NHF, but if you can help me, thank you. If not, also thank you.

Best regards,

Nov 12 '05 #4

P: n/a
In article <8c*************************@posting.google.com> ,
le*********@natpro.com says...
..if this database is just for you to use, why don't you just password
..protect it
..if this database will be used by you and others, but you don't want
..some users to see some data, use ms-access built-in security,
..assigning users rights based on login, there's a MS-faq article that
..describes how to setup it up
..(you just need to try a few times with a test databases to get the
..hang of it)
I will try it. Do you know maybe if this protecton is realy secure? What
I really whant to know is it possible to make fake db, and to import
tables from my db to this fake one, and then read it unprotected?

I spent so many time (private time which is taken of from my kids to make
this db). If I install it into my Pc on work, everybody can use it, which
I want to avoid (column names are made with numbers, but from table
contents it is possible to figure out structure. That I want to avoid).

Therefore, something(which doesn't have to be best encription code) I
would like to implement into my db, which will hide true values of
fields.

I believe that Access security will leave open all contents of tables to
anybody who can open database (shift + enter also open structure of
database).

Anyway, thank you for your help. I appreciate it.

..Lues <pr****@popmail.com> wrote in message news:<MP************************@news.tel.hr>...
..> In article <lu********************************@4ax.com>,
..> to*****@no.spam.cox.net says...
..> >> ..On Thu, 6 May 2004 08:22:30 +0200, Lues <pr****@popmail.com> wrote:
..> >> ..
..> >> ..No.
..> >> ..Your request is naive. I can probably design something that meets your
..> >> ..specific requirements, but I have to pay bills as well. I can command
..> >> ..a reasonable fee by virtue of knowing how to do things people like
..> >> ..Lues don't know how to do. By the same token I gladly pay my mechanic
..> >> ..to maintain my car, and I don't expect a freebie from her.
..> >> ..
..> >> ..-Tom.
..> >> ..
..> >> ..
..> >> ..>Hi,
..> >> ..>
..> >> ..>I'm trying to protect some data in tables with encription (you know why,
..> >> ..>don't you ;))
..> >> ..>
..> >> ..>I must confess that I'm not very expirienced in writing code, especially
..> >> ..>encription code.
..> >> ..>
..> >> ..>Can any one, please , send VB code for access which I can c/p into one
..> >> ..>function. It don't have to be RSA, it can be anything which is easy to
..> >> ..>use and which will make data in tables unreadeable for non authorized
..> >> ..>persons.
..> >> ..>
..> >> ..>Thank you very much
..>
..> OK, thank you very much for clearing things for me. I understood that
..> here people helps each others free of charge, and that is the reason why
..> this service is so much in use. I also helped somebody free of charge in
..> things what I do for a living (it don't envolve computer skills) because
..> I was helped in things that others know better than me. If you are living
..> from making programs why do you read this group at all. Start yor company
..> and go for it, make money. Who stops you?
..>
..> Things what I do with this base is completely non profit, for my purpose
..> only. I want to protect data in tables from reading and using by my
..> collegues. Nobody payed me to make this base, it is made only to help me
..> in what I do every day. If I would like to have profitable program I
..> would not certainly make it in access. I would buy it from professional
..> company who know this topics much more than I. That I call investment in
..> business which is necessary to make.
..>
..> NHF, but if you can help me, thank you. If not, also thank you.
..>
..> Best regards,
..


--

Nikako da smislim Sig!
Nov 12 '05 #5

P: n/a
Lues <pr****@popmail.com> wrote:
I'm trying to protect some data in tables with encription (you know why,
don't you ;))
No, we don't know why.
Can any one, please , send VB code for access which I can c/p into one
function. It don't have to be RSA, it can be anything which is easy to
use and which will make data in tables unreadeable for non authorized
persons.


There's a link at "Copy protection or how to safely distribute a demo Microsoft
Access Application" page at http://www.granite.ab.ca/access/demo.htm

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #6

P: n/a
Lues <pr****@popmail.com> wrote in message news:<MP************************@news.tel.hr>...
In article <8c*************************@posting.google.com> ,
le*********@natpro.com says...
..if this database is just for you to use, why don't you just password
..protect it
..if this database will be used by you and others, but you don't want
..some users to see some data, use ms-access built-in security,
..assigning users rights based on login, there's a MS-faq article that
..describes how to setup it up
..(you just need to try a few times with a test databases to get the
..hang of it)


I will try it. Do you know maybe if this protecton is realy secure? What
I really whant to know is it possible to make fake db, and to import
tables from my db to this fake one, and then read it unprotected?

I spent so many time (private time which is taken of from my kids to make
this db). If I install it into my Pc on work, everybody can use it, which
I want to avoid (column names are made with numbers, but from table
contents it is possible to figure out structure. That I want to avoid).

Therefore, something(which doesn't have to be best encription code) I
would like to implement into my db, which will hide true values of
fields.

I believe that Access security will leave open all contents of tables to
anybody who can open database (shift + enter also open structure of
database).

Anyway, thank you for your help. I appreciate it.


Hi Lues,

Are you running 2000 or higher? Encrypt the entire database.

Right Click DB, Select Properties, and then Click Advanced.

Jeffrey Walton
noloader
Nov 12 '05 #7

P: n/a
Access has encryption capability, but Access itself will decrypt for anyone
allowed to open the database -- it is just really to keep someone from
poking around with a disk file reader from seeing the text values. To
encrypt the data itself, separately, would mean that you'd have to decrypt
it as you used it and that would be a lot of work.

"Lues" <pr****@popmail.com> wrote in message
news:MP************************@news.tel.hr...
In article <8c*************************@posting.google.com> ,
le*********@natpro.com says...
..if this database is just for you to use, why don't you just password
..protect it
..if this database will be used by you and others, but you don't want
..some users to see some data, use ms-access built-in security,
..assigning users rights based on login, there's a MS-faq article that
..describes how to setup it up
..(you just need to try a few times with a test databases to get the
..hang of it)
I will try it. Do you know maybe if this protecton is realy secure? What
I really whant to know is it possible to make fake db, and to import
tables from my db to this fake one, and then read it unprotected?

I spent so many time (private time which is taken of from my kids to make
this db). If I install it into my Pc on work, everybody can use it, which
I want to avoid (column names are made with numbers, but from table
contents it is possible to figure out structure. That I want to avoid).

Therefore, something(which doesn't have to be best encription code) I
would like to implement into my db, which will hide true values of
fields.

I believe that Access security will leave open all contents of tables to
anybody who can open database (shift + enter also open structure of
database).

Anyway, thank you for your help. I appreciate it.

..Lues <pr****@popmail.com> wrote in message news:<MP************************@news.tel.hr>... ..> In article <lu********************************@4ax.com>,
..> to*****@no.spam.cox.net says...
..> >> ..On Thu, 6 May 2004 08:22:30 +0200, Lues <pr****@popmail.com> wrote: ..> >> ..
..> >> ..No.
..> >> ..Your request is naive. I can probably design something that meets your ..> >> ..specific requirements, but I have to pay bills as well. I can command ..> >> ..a reasonable fee by virtue of knowing how to do things people like ..> >> ..Lues don't know how to do. By the same token I gladly pay my mechanic ..> >> ..to maintain my car, and I don't expect a freebie from her.
..> >> ..
..> >> ..-Tom.
..> >> ..
..> >> ..
..> >> ..>Hi,
..> >> ..>
..> >> ..>I'm trying to protect some data in tables with encription (you know why, ..> >> ..>don't you ;))
..> >> ..>
..> >> ..>I must confess that I'm not very expirienced in writing code, especially ..> >> ..>encription code.
..> >> ..>
..> >> ..>Can any one, please , send VB code for access which I can c/p into one ..> >> ..>function. It don't have to be RSA, it can be anything which is easy to ..> >> ..>use and which will make data in tables unreadeable for non authorized ..> >> ..>persons.
..> >> ..>
..> >> ..>Thank you very much
..>
..> OK, thank you very much for clearing things for me. I understood that ..> here people helps each others free of charge, and that is the reason why ..> this service is so much in use. I also helped somebody free of charge in ..> things what I do for a living (it don't envolve computer skills) because ..> I was helped in things that others know better than me. If you are living ..> from making programs why do you read this group at all. Start yor company ..> and go for it, make money. Who stops you?
..>
..> Things what I do with this base is completely non profit, for my purpose ..> only. I want to protect data in tables from reading and using by my
..> collegues. Nobody payed me to make this base, it is made only to help me ..> in what I do every day. If I would like to have profitable program I ..> would not certainly make it in access. I would buy it from professional ..> company who know this topics much more than I. That I call investment in ..> business which is necessary to make.
..>
..> NHF, but if you can help me, thank you. If not, also thank you.
..>
..> Best regards,
..


--

Nikako da smislim Sig!

Nov 12 '05 #8

P: n/a
"Larry Linson" <bo*****@localhost.not> wrote:
Access has encryption capability, but Access itself will decrypt for anyone
allowed to open the database -- it is just really to keep someone from
poking around with a disk file reader from seeing the text values. To
encrypt the data itself, separately, would mean that you'd have to decrypt
it as you used it and that would be a lot of work.


Yeah, but it's only CPU time and today's systems likely wouldn't notice it. Although
a performance test would be interesting on, say, inserting/updating 10K records
manually vs encrypted.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #9

P: n/a
Tony Toews <tt****@telusplanet.net> wrote:
Yeah, but it's only CPU time and today's systems likely wouldn't notice it. Although
a performance test would be interesting on, say, inserting/updating 10K records
manually vs encrypted.


Well, unless it was on a Terminal Server/Citrix system which, by definition, shares
the CPU. The sys admin mightn't be very happy.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #10

P: n/a
Lues <pr****@popmail.com> wrote in message news:<MP************************@news.tel.hr>...
Hi,

I'm trying to protect some data in tables with encription (you know why,
don't you ;))

I must confess that I'm not very expirienced in writing code, especially
encription code.

Can any one, please , send VB code for access which I can c/p into one
function. It don't have to be RSA, it can be anything which is easy to
use and which will make data in tables unreadeable for non authorized
persons.

Thank you very much
--


I published this stuff a long time ago, it's based on a "One Time Pad"
concept, which means it's fast, easy, and ETHIER very strong or very
weak depending on YOUR implementation. I also included a keyed PRNG
(Pseudo Random Number Generator) at the end.

Test, test, and re-test your implementation before going live, the
only differance between trashed data and encrypted data is the ability
to decrypt it!!!

Be carefull, have fun.

<%
' 1) Never user the same key within the pad on two different pieces of
data!
' 2) Be creative when designing your GenPad algorithms, guessing the
seed and repeat values seems
' to be the easiest way for an hacker to attack a well implemented
one time pad.
' 3) Don't encrypt known text that would be normally displayed to a
user. This wouldn't seem to be
' an issue if you mind point one, but since the code for the Rnd
function is known, obtaining a
' valid key sequence can narrow possibilities for a hacker.
' WizPad
' Generates the WizKey(array) pad of key bytes that are then Xor-ed
with each character within an
' plain text input string to create crypto text. WizPad size
parameter can create a WizKey(array)
' pad of any size and WizKey arrays are repeatable by reissuing a
WizPad statement with identical
' parameters. WizPad's Seed and Repeat paramters can be any number
value although WizPad will
' force a non-negative Repeat value to a negative number which is a
requirement of MS's repeatable
' randomize process.
' *** IMPORTANT NOTE *** WizPad's repeatability concept should not be
confused with the general
' concept of reusability, which is the "Kiss of Death" for a one time
pad. One time pad keys should
' never be used to encrypt more than one character per pad use.
WizPad's repeatability concept must
' only be used to decrypt an encrypted string using the same set of
keys. You may however, create a
' single pad large enough to en/decrypt all information on single
page provided you don't use the
' same key twice.
' GenPad
' This routine's only purpose is to generate the seed and repeat
number for WizPad. The reason it is
' separate from WizPad is because any algorithem that is used, may
only be used for one client and
' may not be published for obvious security reasons. Whatever
algorithem is used must be repeatable,
' remember the same WizPad key must be regenerated to decrypt the
crypto text.
' WizET(), WizDT()
' Encrypts and decrypts text strings using a one time pad scheme.
' Basically we run WizPad to create the WizKey(array) pad of bytes to
Xor with each character within an
' input string to create crypto text. The crypto text can then be Xor
with WizKey(array) pad to
' reversed the crypto and retrieve the original input string.
' WizEH(), WizDH()
' Really a derivative of WizET(), WizDT() except WizEH() produces a
crypto hex output and WizDH()
' requires a crypto hex intput. Very fast, but the hex output is
double the length of the imput.
' WizEM(), WizDM()
' These routines call WizET()and WizDT() for the actual encryption
and decryption then call encode64
' and decode64 for the conversion. WizEH() produces a crypto map64
output and WizDH()
' requires a crypto map64 input. Slower than WizEH(), WizDH(), but
the map64 output is of less
' length than hex.
' Encode64(), Decode64()
' Maps text strings to and from characters defined by their position
in the constant Map64 based
' the trusty old uu, xx, base64 3 divided by 4 algorithm.
' Base64 is an algorithm used to convert binary data to printable text
for transmission, and once
' received, converted back to the original binary data. Basically we
treat the input string as a
' stream of 24 bit triplicates (3x8 bit bytes or characters called
octets). Each 24 bit triplicate
' is first split into 4x6 bit values called quartets, then each
quartet is mapped to the printable
' character occupying the position of its 6 bit((0-63.)+1) value in
the Map64 constant. The process
' is then reversed to retrieve the original input string.

Dim WizKey() ' encrypt key
array
Dim WizSeed ' WizPad Seed
Dim WizRepeat ' WizPad
Repeat
Const MAP64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvw xyz0123456789-_"

Sub WizPad(Size, Seed, Repeat) ' routine to
generate random key array
Dim i ' array count
ReDim WizKey(Size) ' build key
array to size
If Sgn(Repeat) = True Then Repeat = Not Repeat ' make sure
repeat is negative
Rnd Repeat ' initialize
random-number generator for repeatable sequence
Randomize Seed ' seed
random-number generator
For i = 1 To Size ' initialize
key loop
WizKey(i) = Int((255 * Rnd) + 0) ' load array
with random key value between 0 and 255
Next ' next key
End Sub ' WizPad

Sub GenPad(Size) ' routine to
generate secret Seed and Repeat values for WizPad
'*** YOUR UNIQUE ALGORITHM REPLACES THE NEXT TWO LINES ***
WizSeed = 1100.123 ' ***
DEMONSTRATION PURPOSES ONLY ***
WizRepeat = -2200.321 ' ***
DEMONSTRATION PURPOSES ONLY ***
WizPad Size, WizSeed, WizRepeat ' generate
random key array
End Sub ' GenPad

Function WizET(Plain) ' routine to
encrypt plain text to crypto text
Dim i ' array count
For i = 1 To Len(Plain) ' loop through
plain text
WizET = WizET & Chr(WizKey(i) Xor Asc(Mid(Plain, i, 1)))
Next ' next plain
text character
End Function ' WizET

Public Function WizDT(Crypt) ' routine to
decrypt crypto text back to plain text
Dim i ' array count

For i = 1 To Len(Crypt) ' loop
encrypted text
WizDT = WizDT & Chr(WizKey(i) Xor Asc(Mid(Crypt, i, 1)))
Next ' next
encrypted text character
End Function ' WizDT

Function WizEH(Text) ' routine to
encrypt plain text to crypto hex values
Dim i ' text length
Dim h ' hex value
For i = 1 To Len(Text) ' loop through
plain text
h = Hex(WizKey(i) Xor Asc(Mid(Text, i, 1))) ' create hex
value of encrypted character
If Len(h) = 1 Then h = "0" & h ' if hex value
needs leading zero, add it
WizEH = WizEH & h ' add
encrypted hex value to return string
Next ' next plain
text character
End Function ' WizEH

Function WizDH(Crypt) ' routine to
decrypt crypto hex values back to plain text
Dim i ' text length
Dim k ' key pointer
Dim v ' hex string
value
k = 1 ' start key
pointer
For i = 1 To Len(Crypt) Step 2 ' loop
encrypted hex values
v = "&H" & Mid(Crypt, i, 2) ' create hex
value
WizDH = WizDH & Chr(WizKey(k) Xor v) ' return plain
text
k = k + 1 ' increament
key pointer
Next ' next
encrypted hex value
End Function ' WizDH

Function WizEM(Text) ' routine to
encrypt plain text to crypto map64 values
WizEM = Encode64(WizET(Text)) '
End Function ' WizEM

Function WizDM(Crypt) ' routine to
decrypt crypto hex values back to plain text
WizDM = WizDT(Decode64(Crypt))
End Function ' WizDM

Function Encode64(Text) ' routine to
encode text to map64
Dim t ' triplicate
Dim i ' pointer

For i = 1 To (Len(Text) \ 3) * 3 Step 3 ' loop through
octets
' build 24 bit triplicate
t = (Asc(Mid(Text, i, 1)) * 65536) + (Asc(Mid(Text, i + 1, 1)) *
CLng(256)) + Asc(Mid(Text, i + 2, 1))
' extract four 6 bit quartets from triplicate
Encode64 = Encode64 & Mid(Map64, (t \ 262144) + 1, 1) & Mid(Map64, ((t
And 258048) \ 4096) + 1, 1) & Mid(Map64, ((t And 4032) \ 64) + 1, 1) &
Mid(Map64, (t And 63) + 1, 1)
Next ' next octet
Select Case Len(Text) Mod 3
Case 1
t = (Asc(Mid(Text, i, 1)) * 65536)
Encode64 = Encode64 & Mid(Map64, (t \ 262144) + 1, 1) & Mid(Map64,
((t And 258048) \ 4096) + 1, 1)
Case 2
t = (Asc(Mid(Text, i, 1)) * 65536) + (Asc(Mid(Text, i + 1, 1)) *
CLng(256))
Encode64 = Encode64 & Mid(Map64, (t \ 262144) + 1, 1) & Mid(Map64,
((t And 258048) \ 4096) + 1, 1) & Mid(Map64, ((t And 4032) \ 64) + 1,
1)
End Select
End Function

Function Decode64(Mapped64) ' routine to
encode map64 to text
Dim t ' triplicate
Dim i ' string
pointer

For i = 1 To (Len(Mapped64) \ 4) * 4 Step 4 ' loop through
quartets
' build 24 bit triplicate
t = (InStr(1, Map64, Mid(Mapped64, i, 1), 0) - 1) * 262144 +
(InStr(1, Map64, Mid(Mapped64, i + 1, 1), 0) - 1) * 4096 + (InStr(1,
Map64, Mid(Mapped64, i + 2, 1), 0) - 1) * 64 + InStr(1, Map64,
Mid(Mapped64, i + 3, 1), 0) - 1
' extract three 8 bit octets from triplicate
Decode64 = Decode64 & Chr(t \ 65536) & Chr((t And 65280) \ 256) &
Chr(t And 255)
Next ' next quartet
Select Case Len(Mapped64) Mod 4
Case 1
t = (InStr(1, Map64, Mid(Mapped64, i, 1), 0) - 1) * 262144
Decode64 = Decode64 & Chr(t \ 65536)
Case 2
t = (InStr(1, Map64, Mid(Mapped64, i, 1), 0) - 1) * 262144 +
(InStr(1, Map64, Mid(Mapped64, i + 1, 1), 0) - 1) * 4096
Decode64 = Decode64 & Chr(t \ 65536)
If ((t And 65280) \ 256) > 0 Then Decode64 = Decode64 & Chr((t And
65280) \ 256)
Case 3
t = (InStr(1, Map64, Mid(Mapped64, i, 1), 0) - 1) * 262144 +
(InStr(1, Map64, Mid(Mapped64, i + 1, 1), 0) - 1) * 4096 + (InStr(1,
Map64, Mid(Mapped64, i + 2, 1), 0) - 1) * 64
Decode64 = Decode64 & Chr(t \ 65536) & Chr((t And 65280) \ 256)
If (t And 255) > 0 Then Decode64 = Decode64 & Chr(t And 255)
End Select
End Function
%>

' **** Pseudo Random Number Generator

Option Compare Database
Option Explicit
' Preliminary Key Setup:
' Allocate an 256 element array of 8 bit bytes to be used for rand():
R(0) .. R(255).
Dim R(255) As Byte ' random byte array
Dim t As Byte ' temporary swap key
value storage
Dim i As Integer ' known first index
value
Dim j As Integer ' unknown second index
value

Public Sub PrngInit(Key As String)
' Pseudo Random Key Initialization
Dim kl As Integer ' key length

kl = Len(Key) ' get key length
' Initialize random array with equal number distribution. Fill each
element first with it's
' index: R(0) = 0; R(1) = 1; etc. up to R(255) = 255
For i = 0 To 255 ' random array loop ()
R(i) = i ' random byte is index
Next i ' next random byte
element

' Set j to zero and initialize the random array with the key like
this, repeating key bytes
' as necessary:
For i = 0 To 255 ' randomize array loop
' j = (j + R(i) + key[i Mod keylen]) Mod 256
j = (j + R(i) + Asc(Mid(Key, (i Mod kl) + 1, 1))) And 255
' randomize
t = R(i) ' save known index value
to temporary storage
R(i) = R(j) ' replace known index
value with unknown index value
R(j) = t ' replace unknown index
value with saved known index value
Next i ' next random array
element
i = 0 ' init for PrngRand
j = 0 ' init for PrngRand
PrintRandArry
End Sub

Private Function PrngRand() As Byte
' Pseudo Random Number Generation
Dim z As Integer ' unknown second index
value
i = (i + 1) And 255 ' set unknown first
index value
j = (j + R(i)) And 255 ' set unknown second
index value
' randomize
t = R(i) ' save known index value
to temporary storage
R(i) = R(j) ' replace known index
value with unknown index value
R(j) = t ' replace unknown index
value with saved known index value
z = R(i)
z = (z + R(j)) And 255
PrngRand = R(z) ' return random byte
End Function
Nov 12 '05 #11

P: n/a
In article <MP************************@news.tel.hr>, pr****@popmail.com
says...
..Hi,
..
..I'm trying to protect some data in tables with encription (you know why,
..don't you ;))
..
..I must confess that I'm not very expirienced in writing code, especially
..encription code.
..
..Can any one, please , send VB code for access which I can c/p into one
..function. It don't have to be RSA, it can be anything which is easy to
..use and which will make data in tables unreadeable for non authorized
..persons.
..
..Thank you very much
..


I want to thank to all who posted their suggestions, links and code.

Thank you all,
Nov 12 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.