Section for Week 10, Tuesday, 3/16/99
Note:
Seventh HW solutions are posted.
Eighth will be posted when the HW becomes past-due.
Thursday's section will be a review for the final. Be there or be square.
1. NUMBERS
Diffie-Hellman key exchange:
Pick p (~1024 bits), g
902378210
CHEN, KENNETH YU
kennych@ucla.edu
PECO-INT
to:
902378210:CHEN, KENNETH YU:kennych@ucla.edu:PECO-INT
Simplest way to not have to deal with newlines: slurp in the whole
file as one string. To do this we undefine the input record
seperator. By default the input record seperator is a newline which
is why when we usually do $data=<> we get one line into $data.
However, doing:
undef $/;
$data=<>;
Will have the effect of taking the whole input as one long string
(containing newlines etc.) and putting it in $data.
What then?
Need to get rid of the newlines and spacing from indentation, so we
do:
$data =~ s/\s+/ /g;
What does this do? What does the 'g' do?
Lengthy explanation of using while(/<...>.*?<...>/g) {} construct
(specifically, the use of the 'g' modifier).
Once you think you have both parts done, try piping the output of one
into the other:
8.1a h/rosterx |8.1b
should generate the rosterx file back at you.
3. The password Suite
"create an empty user_data file" -- you can do this either by typing
"pico user_data" and then using ctrl-O (to write out the file, without
typing anything in) or else do:
"cat /dev/null > user_data"
The file locking outlined in the assignment is a bit messy (and makes
possible a race condition). Instead, use &lock before the first file
access and &unlock after the last file access.