| От | Joe Conway |
|---|---|
| Тема | Re: Random strings |
| Дата | |
| Msg-id | 003701c120a1$5319fc80$0205a8c0@jecw2k1 обсуждение исходный текст |
| Ответ на | Re: Random strings (Peter Eisentraut <peter_e@gmx.net>) |
| Список | pgsql-patches |
> > Perhaps one of these returning bytea would be enough and you can use > > the new encode functions to convert them to a format of choice. Also, why > > aren't you using /dev/random? > Here's a revised patch. This one has only one user function, randomstr(int binlen, text source). It allows any length request (well, limited by int) against a source of 'urandom', or a maximum of 64 bytes against a source of 'random'. I also added a couple of examples to the readme to show how to use randomstr() with encode() to get hex or base64 output. On a side note, in the last version of this, I had a function which escaped the binary C string so that I could feed it to byteain. In this version, I decided to populate the varlena struct directly, because it seemed an awful waste to escape the binary just so that byteain could unescape it. But I'm not sure this is considered a "good thing", or a "bad thing". I'd appreciate any guidance. Thanks, Joe
В списке pgsql-patches по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера