× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Here's a routine I have for using it:

(prototype for the CIPHER MI, doc at http://publib.boulder.ibm.com/iseries/v5r1/ic2924/tstudio/tech_ref/mi/CIPHER.htm)

Dcipher PR extproc('_CIPHER')
D receiver *
D control 96A OPTIONS(*VARSIZE)
D source *

(actual procedure)

*//////////////////////////////////////////////////////////////*
* (GenAESSalt) Generate a 16 byte salt for use with AES. *
*//////////////////////////////////////////////////////////////*
PGenAESSalt B
*--------------------------------------------------------------*
DGenAESSalt PI 16A

DPRN_Controls DS
D FunctionID 2A
D SeedRequest 1A
D Reserved1 3A
D SeedLength 5U 0
D PRNRequest 1A
D PRNParity 1A
D Reserved2 4A
D NumberOfPRNs 5U 0
D Reserverd3 16A

DNO_SEED C const(x'00')
DADD_SEED C const(x'01')
DGEN_REAL_PRN C const(x'00')
DGEN_TEST_PRN C const(x'01')
DNO_PARITY C const(x'00')
DODD_PARITY C const(x'01')
DEVEN_PARITY C const(x'02')

Dp_recv S *
DP_src S *
Dbuff_in S 16A
Dbuff_out S 16A

/free
p_recv = %addr(buff_out);
p_src = %addr(buff_in);

//
// Setup CIPHER for a secure random number
//

PRN_Controls = *ALLx'00';
FunctionID = FUNCID_PRN;
PRNRequest = GEN_REAL_PRN;
// NumberOfPRNs is the number of bytes to return.
NumberOfPRNs = 16;
PRNParity = NO_PARITY;


//
// Generate a secure random number
//

cipher(p_recv: PRN_Controls: p_src);

return buff_out;

/end-free
PGenAESSalt E

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Nathan Andelin
Sent: Monday, September 08, 2008 3:29 PM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] Random String Generator

Haas, Matt (CL Tech Sv) wrote:
What random number generator are you using?

I wrote an RPG wrapper around the CEERAN0 api, and applied logic so the
result would fit within minimum-maximum range parameters.

I wasn't aware of the random number procedures in the crypto package, so
thanks for the tip.

Nathan.
--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.