07-19-2015, 07:54 PM

Hello,

Could you please add Circular Shift Functions for both Lists Type and Binary Bits Type to the HP Prime and also Xcas.

These Functions would be very useful for teaching Elementary Cryptography and also Programming.

I am thinking of a fun elementary cryptography App. on HP Prime, where the teacher and students could send encrypted text to each other using basic methods like Caesar Shift and Block Codes. Then students would decode received message using supplied algorithms they learn about in Class.

See Wikipedia "Circular Shift " for more info.

Some C code to help you start:

/*

* Shift operations in C are only defined for shift values which are

* not negative and smaller than sizeof(value) * CHAR_BIT.

*/

Rotate Left Example:

unsigned int rotl(unsigned int value, int shift) {

return (value << shift) | (value >> (sizeof(value) * CHAR_BIT - shift));

}

Rotate Right Example:

unsigned int rotr(unsigned int value, int shift) {

return (value >> shift) | (value << (sizeof(value) * CHAR_BIT - shift));

}

Thanks !

Colm

Could you please add Circular Shift Functions for both Lists Type and Binary Bits Type to the HP Prime and also Xcas.

These Functions would be very useful for teaching Elementary Cryptography and also Programming.

I am thinking of a fun elementary cryptography App. on HP Prime, where the teacher and students could send encrypted text to each other using basic methods like Caesar Shift and Block Codes. Then students would decode received message using supplied algorithms they learn about in Class.

See Wikipedia "Circular Shift " for more info.

Some C code to help you start:

/*

* Shift operations in C are only defined for shift values which are

* not negative and smaller than sizeof(value) * CHAR_BIT.

*/

Rotate Left Example:

unsigned int rotl(unsigned int value, int shift) {

return (value << shift) | (value >> (sizeof(value) * CHAR_BIT - shift));

}

Rotate Right Example:

unsigned int rotr(unsigned int value, int shift) {

return (value >> shift) | (value << (sizeof(value) * CHAR_BIT - shift));

}

Thanks !

Colm