Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > cbc_crypt functioning

Reply
Thread Tools

cbc_crypt functioning

 
 
Bill Cunningham
Guest
Posts: n/a
 
      05-03-2012
ok. Let me try to start at the beginning and make this as simple as
possible and try to make sense. The first two parameters to cbc_crypt are
char *. And therefore are 8 bytes in size each. Now this 3rd parameter
confuses me. It says multiples of 8 must exist. Parameter 1 and 2 should
each be 8 bytes. How does one make sure that strlen always reports an
unsigned type of a number that is a multiple of 8? Isn't this what this
function is wanting? Is a size_t just and unsigned int?

Bill


 
Reply With Quote
 
 
 
 
Ben Bacarisse
Guest
Posts: n/a
 
      05-03-2012
"Bill Cunningham" <> writes:

> ok. Let me try to start at the beginning and make this as simple as
> possible and try to make sense. The first two parameters to cbc_crypt are
> char *. And therefore are 8 bytes in size each.


That may be true on your machine, but it might not be true on mine or
someone else's. That said, I am almost certain that you are confusing
the size of the pointer with the size of the thing it points to.

cbc_crypt is not standard C, so there is no way I can know what function
you are talking about. Questions about how to use it are better off in
a group where people will all be talking about the same function. You
probably want comp.unix.programmer.

> Now this 3rd parameter
> confuses me. It says multiples of 8 must exist. Parameter 1 and 2 should
> each be 8 bytes. How does one make sure that strlen always reports an
> unsigned type of a number that is a multiple of 8?


This is, in a way, a C question but strlen does not come into it. If a
function says that the data length must be a multiple of 8 all it means
is that it's up to you to ensure that that's true. It just means that
valid arguments are 0, 8, 16, 24... and so on. Of course, you also have
to ensure that there actually are that many bytes available, so your
data array must be at least that many bytes in size (it can be larger of
course).

> Isn't this what this
> function is wanting? Is a size_t just and unsigned int?


No, size_t is some unsigned integer type, not necessarily unsigned int.

--
Ben.
 
Reply With Quote
 
 
 
 
Bill Cunningham
Guest
Posts: n/a
 
      05-03-2012
Ben Bacarisse wrote:

> cbc_crypt is not standard C, so there is no way I can know what
> function you are talking about.


http://linux.die.net/man/3/cbc_crypt

Questions about how to use it are
> better off in a group where people will all be talking about the same
> function. You probably want comp.unix.programmer.


>> Now this 3rd parameter
>> confuses me. It says multiples of 8 must exist. Parameter 1 and 2
>> should each be 8 bytes. How does one make sure that strlen always
>> reports an unsigned type of a number that is a multiple of 8?

>
> This is, in a way, a C question but strlen does not come into it. If
> a function says that the data length must be a multiple of 8 all it
> means is that it's up to you to ensure that that's true. It just
> means that valid arguments are 0, 8, 16, 24... and so on. Of course,
> you also have to ensure that there actually are that many bytes
> available, so your data array must be at least that many bytes in
> size (it can be larger of course).
>
>> Isn't this what this
>> function is wanting? Is a size_t just and unsigned int?

>
> No, size_t is some unsigned integer type, not necessarily unsigned
> int.


I don't know what you mean by the above types comment.

Bill



 
Reply With Quote
 
Barry Schwarz
Guest
Posts: n/a
 
      05-03-2012
On Thu, 03 May 2012 13:04:17 +0100, Ben Bacarisse
<> wrote:

>"Bill Cunningham" <> writes:
>

snip

We are being trolled. Bill has already changed the topic twice. He
started with iterating functions, then claimed he didn't understand
the difference between if and for, and now this gibberish. And just
for good measure, he started at least two new threads with different
subjects.

I never should have responded to the first one.

--
Remove del for email
 
Reply With Quote
 
osmium
Guest
Posts: n/a
 
      05-03-2012
"Bill Cunningham" wrote:

> Ben Bacarisse wrote:
>
>> cbc_crypt is not standard C, so there is no way I can know what
>> function you are talking about.

>
> http://linux.die.net/man/3/cbc_crypt


C is a programming language.

Linux is an operating system.

They are different things. There is very likely a Usenet group for Linux;
try to find one.


 
Reply With Quote
 
Ben Bacarisse
Guest
Posts: n/a
 
      05-03-2012
"Bill Cunningham" <> writes:

[You've snipped my attribution lines so I can't show that the question
was originally yours. I try to keep attributions for all text I quote.]

> Ben Bacarisse wrote:


(actually Bill, not me)
>>> Isn't this what this
>>> function is wanting? Is a size_t just and unsigned int?

>>
>> No, size_t is some unsigned integer type, not necessarily unsigned
>> int.

>
> I don't know what you mean by the above types comment.


Which bit is causing trouble? "unsigned int" is one of a whole range of
unsigned integer types in C (unsigned long long int, unsigned char,
unsigned short int and so on). size_t is some unsigned integer type but
not necessarily unsigned int. It might, for example, be unsigned long
int.

--
Ben.
 
Reply With Quote
 
Ben Bacarisse
Guest
Posts: n/a
 
      05-03-2012
Barry Schwarz <> writes:

> On Thu, 03 May 2012 13:04:17 +0100, Ben Bacarisse
> <> wrote:
>
>>"Bill Cunningham" <> writes:
>>

> snip
>
> We are being trolled.


Maybe. Maybe not. I avoid having to decide by replying if I can see
some value in the content of my reply, rather than in the questioner's
motivation.

My message said (a) don't confuse the size of a pointer with the size of
the thing it points to; (b) go to comp.unix.programmer to find out more
about how to use cbc_crypt; and (c) it clarified a point about size_t.
That all tipped the balance into it being worth replying no matter who
asked. I long ago stopped expecting Bill to derive any benefit from my
posts.

<snip>
--
Ben.
 
Reply With Quote
 
Bill Cunningham
Guest
Posts: n/a
 
      05-03-2012
Ben Bacarisse wrote:
> "Bill Cunningham" <> writes:
>
> [You've snipped my attribution lines so I can't show that the question
> was originally yours. I try to keep attributions for all text I
> quote.]


Sorry.


 
Reply With Quote
 
Bill Cunningham
Guest
Posts: n/a
 
      05-03-2012
Ben Bacarisse wrote:
> Barry Schwarz <> writes:
>
>> On Thu, 03 May 2012 13:04:17 +0100, Ben Bacarisse
>> <> wrote:
>>
>>> "Bill Cunningham" <> writes:
>>>

>> snip
>>
>> We are being trolled.

>
> Maybe. Maybe not. I avoid having to decide by replying if I can see
> some value in the content of my reply, rather than in the questioner's
> motivation.

[snip]

I began a thread about iterating and wasn't thinking about exactly what
I wanted and chopped up the post. I was there interested in a function
written in ansi or iso C that would check a number for multiples of 8. A
factor tree of sorts. A function that taking a number like 16 would factor
out 2 8s. This would be passed somehow to the OT cbc_crypt function's
parameter. I was getting ahead of myself. I guess it's not done like that.
You have to manually set the multiples of 8 youself.

Bill


 
Reply With Quote
 
Bill Cunningham
Guest
Posts: n/a
 
      05-03-2012
Ben Bacarisse wrote:

> Which bit is causing trouble? "unsigned int" is one of a whole range
> of unsigned integer types in C (unsigned long long int, unsigned char,
> unsigned short int and so on). size_t is some unsigned integer type
> but not necessarily unsigned int. It might, for example, be unsigned
> long int.


unsigned char is an int? I thought there were several types but they
weren't all ints. Signed and unsignedness I know.
shorts longs and long longs I can understand as ints but I've never thought
of a char being an int.

Bill


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cisco 7200 Console port not functioning mdk@iping.org Cisco 5 05-26-2005 03:04 AM
Active FTP on PIX not functioning valicon Cisco 1 04-08-2005 03:41 AM
Unable to set up functioning workgroup =?Utf-8?B?RG9u?= Wireless Networking 8 02-19-2005 06:39 AM
Wireless network is functioning but icon indicates it is disconnected and status unavailable Peter Welk Wireless Networking 5 01-02-2005 02:57 PM
Aironet 1200 - Is my Radio functioning? Forrest Cisco 8 07-13-2004 12:20 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57